12345678910111213141516 |
- using System;
- namespace Wayne.Lib
- {
- public static class ObjectExtensions
- {
- public static TGeneral WhenOfType<TGeneral, TSpecial>(this TGeneral o, Action<TSpecial> action) where TSpecial : TGeneral
- {
- if (o is TSpecial)
- {
- action((TSpecial)o);
- }
- return o;
- }
- }
- }
|