Optimised ClassAttributeClass a bit more
This commit is contained in:
@@ -21,23 +21,10 @@ namespace PashaBibko.Pacore
|
||||
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)]
|
||||
private static void ScanAllAssemblies()
|
||||
{
|
||||
using (CodeProfiler.Start("Assembly scan"))
|
||||
{
|
||||
/* Fetches all the class types in all loaded assemblies */
|
||||
Type[] classes = AppDomain.CurrentDomain.GetAssemblies() // Assembly[]
|
||||
.SelectMany(assembly =>
|
||||
{
|
||||
try
|
||||
{
|
||||
return assembly.GetTypes();
|
||||
}
|
||||
|
||||
catch (ReflectionTypeLoadException err)
|
||||
{
|
||||
return err.Types.Where(t => t != null);
|
||||
}
|
||||
}) // IEnumerable<Type>
|
||||
.SelectMany(assembly => assembly.GetTypes()) // IEnumerable<Type>
|
||||
.Where(type => type.IsClass && !type.IsAbstract) // IEnumerable<Type>
|
||||
.ToArray();
|
||||
|
||||
@@ -69,5 +56,4 @@ namespace PashaBibko.Pacore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user