private TreeGridItemCollection GenerateTree() { //create a tree of dictionaries to ensure uniqueness of namespaces and define structure var tree = new Dictionary <string, object>(); counts = new Dictionary <string, int>(); foreach (var type in typesFiltered) { RecurseNamespace(type.Namespace.Split('.'), tree, type); //treat the type name as part of the namespace, since now we are using constructors to populate //out tree items IncreaseCounts($"{type.Namespace}.{type.Name}", GetValidConstr(type).Count()); } var item = new TreeGridItem(); var collection = new TreeGridItemCollection(); RecurseTree(tree, item); collection.AddRange(item.Children); return(collection); }