private void CatalogPublicTypes(IEnumerable <Type> types) { string lastNs = "!!not a namespace!!"; ReflectionNamespace lastNsEntity = null; foreach (Type type in types) { #if DNXCORE50 if (!type.GetTypeInfo().IsPublic) { continue; } #else if (!type.IsPublic) { continue; } #endif string ns = type.Namespace ?? string.Empty; //retrieve the namespace only if we don't have it handy already //usually we'll have it since GetExportedTypes() seems to export //types in a sorted fashion. if (ns != lastNs) { lastNs = ns; lastNsEntity = GetNamespace(ns); lastNsEntity.Add(type); } else { lastNsEntity.Add(type); } } }
public ReflectionNamespace GetNamespace(string ns) { if (ns.Length == 0) { return(_root); } string[] namespaceHierarchy = ns.Split('.'); ReflectionNamespace current = _root; foreach (string namespacePart in namespaceHierarchy) { current = current.Produce(namespacePart); } return(current); }
public ChildReflectionNamespace(ReflectionNamespace parent, string name) : base(parent._provider) { _parent = parent; _name = name; }
public ReflectionNamespaceBuilder(IReflectionTypeSystemProvider provider, Assembly assembly) { _root = new ReflectionNamespace(provider); _assembly = assembly; }