public NamespaceEntity GetNamespace(string ns) { string[] namespaceHierarchy = ns.Split('.'); string topLevelName = namespaceHierarchy[0]; NamespaceEntity topLevel = GetTopLevelNamespace(topLevelName); NamespaceEntity current = topLevel; for (int i = 1; i < namespaceHierarchy.Length; ++i) { current = current.GetChildNamespace(namespaceHierarchy[i]); } return(current); }