/// <summary>
        /// Parse the specified name into a child <see cref="NamespaceRef"/> or <see cref="TypeRef"/> on the current namespace,
        /// or a <see cref="Dot"/> expression that evaluates to one.
        /// </summary>
        public virtual Expression ParseName(string name)
        {
            string      prefix = RemovePrefix(ref name);
            SymbolicRef symbolicRef;
            object      obj;

            lock (this)
                obj = _children.Find(prefix);
            if (obj != null)
            {
                if (obj is Namespace)
                {
                    symbolicRef = new NamespaceRef((Namespace)obj);
                }
                else if (obj is ITypeDecl)
                {
                    symbolicRef = new TypeRef((ITypeDecl)obj);
                }
                else //if (obj is Type)
                {
                    symbolicRef = new TypeRef((Type)obj);
                }
            }
            else
            {
                symbolicRef = new UnresolvedRef(prefix);
            }
            return(string.IsNullOrEmpty(name) ? symbolicRef : ParseName(symbolicRef, name));
        }
        /// <summary>
        /// Remove all items from the referenced <see cref="Namespace"/>.
        /// </summary>
        public void RemoveAll()
        {
            NamespaceRef namespaceRef = Namespace;

            if (namespaceRef != null)
            {
                namespaceRef.RemoveAll();
            }
        }
        /// <summary>
        /// Remove a <see cref="Type"/> from the referenced <see cref="Namespace"/>.
        /// </summary>
        public void Remove(Type type)
        {
            NamespaceRef namespaceRef = Namespace;

            if (namespaceRef != null)
            {
                namespaceRef.Remove(type);
            }
        }
        /// <summary>
        /// Remove a child <see cref="Namespace"/> from the referenced <see cref="Namespace"/>.
        /// </summary>
        public void Remove(Namespace @namespace)
        {
            NamespaceRef namespaceRef = Namespace;

            if (namespaceRef != null)
            {
                namespaceRef.Remove(@namespace);
            }
        }
        /// <summary>
        /// Add a <see cref="Type"/> to the referenced <see cref="Namespace"/>.
        /// </summary>
        public void Add(Type type)
        {
            NamespaceRef namespaceRef = Namespace;

            if (namespaceRef != null)
            {
                namespaceRef.Add(type);
            }
        }
        /// <summary>
        /// Add a child <see cref="Namespace"/> to the referenced <see cref="Namespace"/>.
        /// </summary>
        public void Add(Namespace @namespace)
        {
            NamespaceRef namespaceRef = Namespace;

            if (namespaceRef != null)
            {
                namespaceRef.Add(@namespace);
            }
        }
        /// <summary>
        /// Parse the specified name into a child <see cref="NamespaceRef"/> or <see cref="TypeRef"/> on the referenced namespace,
        /// or a <see cref="Dot"/> expression that evaluates to one.
        /// </summary>
        public Expression ParseName(string name)
        {
            NamespaceRef namespaceRef = Namespace;

            return(namespaceRef != null ? namespaceRef.ParseName(name) : null);
        }
        /// <summary>
        /// Find or create a child <see cref="Namespace"/>, including any missing parent namespaces.
        /// </summary>
        public Namespace FindOrCreateChildNamespace(string namespaceName)
        {
            NamespaceRef namespaceRef = Namespace;

            return(namespaceRef != null ? namespaceRef.FindOrCreateChildNamespace(namespaceName) : null);
        }
        /// <summary>
        /// Determine if the current reference refers to the same code object as the specified reference.
        /// </summary>
        public override bool IsSameRef(SymbolicRef symbolicRef)
        {
            NamespaceRef namespaceRef = (symbolicRef is AliasRef ? ((AliasRef)symbolicRef).Namespace : symbolicRef as NamespaceRef);

            return(namespaceRef != null && Reference == namespaceRef.Reference);
        }