How can I improve the performance of this method or is it already good?private static void LoadAssembliesWithInjectorModule(IEnumerable<FileInfo> files){    var moduleType = typeof (InjectorModule);    foreach (var file in files)    {        try        {            var assembly = Assembly.LoadFrom(file.FullName);            var moduleTypes = from assemblyType in assembly.GetTypes()                              where moduleType.IsAssignableFrom(assemblyType) && !assemblyType.IsAbstract                              select assemblyType;            if (!moduleTypes.Any()) continue;            foreach (var instance in moduleTypes.Select(type => Activator.CreateInstance(type) as InjectorModule))            {                instance.Load();            }        }        catch (BadImageFormatException)        {            //Files that aren't class libraries will throw this exception, just eat it and move on.        }        catch (ReflectionTypeLoadException e)        {            throw new AppDomainUnloadedException(string.Format(Error loading {0} exception {1} loading errors {2}, file.FullName, e.Message, e.LoaderExceptions), e);        }    }}
Load assemblies with injector module
c#;performance;.net;linq
I would suggest swapping the checks on this line fromwhere moduleType.IsAssignableFrom(assemblyType) && !assemblyType.IsAbstracttowhere !assemblyType.IsAbstract && moduleType.IsAssignableFrom(assemblyType)Checking a boolean property will be faster than a method call to check the type. If it's not abstract why check the type?You might also want to filter further by requiring that it is a class:where assemblyType.IsClass       && !assemblyType.IsAbstract       && moduleType.IsAssignableFrom(assemblyType)