public void Do() { List <Type> componentsResult = new List <Type>(); foreach (var assembly in assemblies) { var components = from type in assembly.GetTypes() where type.FullName?.StartsWith(prefix) ?? false where type.GetCustomAttribute <ComponentAttribute>() != null select type; componentsResult.AddRange(components); } SLogger <ClassComponentsLoader> .Info($"Found {componentsResult.Count()} class component"); componentsResult.ForEach(t => { try { ClassComponentRegister.Register(target, t); } catch (Exception e) { SLogger <ClassComponentsLoader> .Exception(e); } }); }