Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- public static Func<Object, bool> delegateFunc { get; set; }
- static void Main()
- {
- // check if type is a class
- delegateFunc = IsAClass;
- Console.WriteLine(delegateFunc(new List<int>()));
- // check if type is a delegate
- delegateFunc = IsADelegate;
- Console.WriteLine(delegateFunc(delegateFunc));
- }
- static bool IsAClass(Object obj)
- {
- return obj.GetType().IsClass;
- }
- static bool IsADelegate(Object obj)
- {
- return obj is Delegate;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement