CSharp examples for System:Type
Is Type Child Of another Type
using System.Linq.Expressions; using System.Reflection; using System.Text; using System.Linq; using System.Collections.Generic; using System;//from ww w. ja v a 2 s . co m public class Main{ public static bool IsChildOf(this Type tc, Type tf) { if (tf.IsInterface) { return tc.GetInterfaces().Any(type => type.Equals(tf)); } return tc.IsSubclassOf(tf); } }