public TypeCollection ReflectOnAssembly(Assembly assembly, IncludeKind includeKind) { TypeCollection typeCollection = new TypeCollection(); Type[] types = assembly.GetTypes(); foreach (Type type in types) { // Skip any classes they don't want us to include. IncludeKind currentIncludeKind = type.IsPublic ? IncludeKind.Public : IncludeKind.Internal; if ((currentIncludeKind & includeKind) == 0) { continue; } // Skip compiler-generated classes, which are invisible to both // consumers of the assembly and to the assembly's creator. if (type.Name.StartsWith("<")) { continue; } TypeDoc typeDoc = ConvertTypeToDocForm(type, includeKind); typeCollection = typeCollection.AddType(typeDoc.Name, typeDoc); } return(typeCollection); }
private static TypeCollection AddAssemblyTypes(this TypeCollection collection, Assembly assembly, Func <Type, bool> filter = null) { foreach (var type in assembly.GetTypes()) { if (filter is null || filter(type)) { collection.AddType(type); } } return(collection); }