Esempio n. 1
0
        public static IEnumerable <Type> GetImplementedTypes(Type type)
        {
            Dictionary <Type, object> types = new Dictionary <Type, object>();

            TypeHelper.GetImplementedTypesHelper(type, types);
            return(types.Keys);
        }
Esempio n. 2
0
 private static void GetImplementedTypesHelper(Type type, Dictionary <Type, object> typesEncountered)
 {
     if (!typesEncountered.ContainsKey(type))
     {
         typesEncountered.Add(type, type);
         Type[] interfaces = type.GetInterfaces();
         for (int i = 0; i < (int)interfaces.Length; i++)
         {
             TypeHelper.GetImplementedTypesHelper(interfaces[i], typesEncountered);
         }
         for (Type j = type.BaseType; j != null && j != TypeHelper.ObjectType; j = j.BaseType)
         {
             TypeHelper.GetImplementedTypesHelper(j, typesEncountered);
         }
         return;
     }
     else
     {
         return;
     }
 }