Boo.Lang.Compiler.TypeSystem.NamespaceEntity.GetChildNamespace C# (CSharp) Method

GetChildNamespace() public method

public GetChildNamespace ( string name ) : NamespaceEntity
name string
return NamespaceEntity

        public NamespaceEntity GetChildNamespace(string name)
        {
            NamespaceEntity tag;
            _childrenNamespaces.TryGetValue(name, out tag);
            if (null == tag)
            {
                tag = new NamespaceEntity(this, _typeSystemServices, _name + "." + name);
                _childrenNamespaces[name] = tag;
            }
            return tag;
        }

Usage Example

Example #1
0
        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);
        }