SharpLibUtils/Reflection.cs
changeset 260 d44943088c67
parent 232 5a739e2e5255
     1.1 --- a/SharpLibUtils/Reflection.cs	Tue Aug 30 11:04:40 2016 +0200
     1.2 +++ b/SharpLibUtils/Reflection.cs	Tue Aug 30 16:50:37 2016 +0200
     1.3 @@ -12,6 +12,7 @@
     1.4      {
     1.5          /// <summary>
     1.6          /// Get a list of all the concrete types derived from the given type in all loaded assembly.
     1.7 +        /// That includes the given type itself if it's intanciable.
     1.8          /// </summary>
     1.9          /// <typeparam name="T"></typeparam>
    1.10          /// <returns></returns>
    1.11 @@ -21,8 +22,8 @@
    1.12  
    1.13              foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies())
    1.14              {
    1.15 -                foreach (Type type in asm.GetTypes()
    1.16 -                        .Where(myType => myType.IsClass && !myType.IsAbstract && myType.IsSubclassOf(typeof(T))))
    1.17 +                foreach (Type type in asm.GetTypes()                        
    1.18 +                        .Where(myType => myType.IsClass && !myType.IsAbstract && (myType.IsSubclassOf(typeof(T)) || myType == typeof(T))))
    1.19                  {
    1.20                      objects.Add(type);
    1.21                  }