Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static IEnumerable<Type> GetTypesof<T>()
- {
- return from a in AppDomain.CurrentDomain.GetAssemblies()
- from t in a.GetTypes()
- where t.IsSubclassOf(typeof(T))
- where !t.IsAbstract
- where t.GetConstructor(Type.EmptyTypes) != null
- select t;
- }
- public static IEnumerable<Type> GetTypesofInterface<T>()
- {
- return from a in AppDomain.CurrentDomain.GetAssemblies()
- from t in a.GetTypes()
- where !t.IsAbstract
- where t.GetInterfaces().Contains(typeof(T))
- where t.GetConstructor(Type.EmptyTypes) != null
- select t;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement