Exemplo n.º 1
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(((FullNamespace != null ? FullNamespace.GetHashCode() : 0) * 397) ^ (Name != null ? Name.GetHashCode() : 0));
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Convert a base-type DotNetQualifiedName to a DotNetQualifiedTypeName.
 /// </summary>
 public DotNetQualifiedTypeName ToDotNetQualifiedTypeName()
 {
     if (FullNamespace == null)
     {
         return(new DotNetQualifiedTypeName(localName));
     }
     return(new DotNetQualifiedTypeName(localName, FullNamespace.ToDotNetQualifiedTypeName()));
 }
Exemplo n.º 3
0
 /// <summary></summary>
 public override int GetHashCode()
 {
     if (FullNamespace == null)
     {
         return(LocalName.GetHashCode());
     }
     return(LocalName.GetHashCode() ^ FullNamespace.GetHashCode());
 }
Exemplo n.º 4
0
        /// <summary>
        /// Collect full list of local names used throughout documentation.
        /// Includes namespaces, internal types, external types, and members.
        /// Does not include generic paremeters.
        /// </summary>
        internal virtual List <string> GetFullListOfLocalNames()
        {
            List <string> localNames = new List <string>();

            localNames.Add(localName);
            if (FullNamespace != null)
            {
                localNames.AddRange(FullNamespace.GetFullListOfLocalNames());
            }

            return(localNames);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Returns an array of the name segments that make up this qualified name.
        /// </summary>
        /// <remarks>Does not include explicit interface implementations.</remarks>
        /// <example>"System.Collections.Generic".Flatten() returns ["System", "Collections", "Generic"].</example>
        public string[] Flatten()
        {
            if (FullNamespace == null)
            {
                return new string[] { LocalName }
            }
            ;

            List <string> segments = new List <string>(FullNamespace.Flatten());

            segments.Add(LocalName);
            return(segments.ToArray());
        }
Exemplo n.º 6
0
        /// <summary>
        /// Simplifies this qualified name based on the <paramref name='other'/> name.
        /// In other words, removes the portion of the namespace that this and the <paramref name='other'/> have in common.
        /// Alters the current object.
        /// </summary>
        /// <remarks>Will always keep at least the LocalName.</remarks>
        /// <remarks>Preserves explicit interface implementations.</remarks>
        /// <example>"System.Collections.Generic.List".Localize("System.Collections") returns "Generic.List".</example>
        /// <example>"System.Collections.Generic.List".Localize("System.Collections.Standard.List") returns "Standard.List".</example>
        /// <example>"System.Collections.Generic.List".Localize("System.Collections.Generic.List") returns "List".</example>
        public virtual void Localize(DotNetQualifiedName other)
        {
            if (FullNamespace == null || other == null)
            {
                return;
            }

            if (FullNamespace == other || other.IsWithin(FullNamespace))
            {
                FullNamespace = null;
            }
            else
            {
                FullNamespace.Localize(other);
            }
        }
        /// <summary>
        /// Collect full list of local names used throughout documentation.
        /// Includes namespaces, internal types, external types, and members.
        /// Does not include generic paremeters.
        /// </summary>
        internal override List <string> GetFullListOfLocalNames()
        {
            List <string> localNames = new List <string>();

            localNames.Add(localName);
            foreach (DotNetQualifiedName parameter in GenericTypeParameters)
            {
                localNames.AddRange(parameter.GetFullListOfLocalNames());
            }
            if (FullNamespace != null)
            {
                localNames.AddRange(FullNamespace.GetFullListOfLocalNames());
            }

            return(localNames);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Returns deep clone of qualified name.
        /// </summary>
        public virtual DotNetQualifiedName Clone()
        {
            DotNetQualifiedName clonedFullNamespace = null;

            if (FullNamespace != null)
            {
                clonedFullNamespace = FullNamespace.Clone();
            }

            DotNetQualifiedName clonedExplicitInterface = null;

            if (ExplicitInterface != null)
            {
                clonedExplicitInterface = ExplicitInterface.Clone();
            }

            return(new DotNetQualifiedName(localName, clonedFullNamespace, clonedExplicitInterface));
        }
Exemplo n.º 9
0
        /// <example>
        /// For "System.Collections.Generic.List",
        /// Depth = 0 at "List"
        /// Depth = 1 at "Generic"
        /// Depth = 2 at "Collections"
        /// Depth = 3 at "System"
        /// </example>
        private string ToString(int depth)
        {
            string fullName = (FullNamespace == null) ? LocalName : Combine(FullNamespace.ToString(depth + 1), LocalName);

            return(ApplyNameConverter(fullName, depth));
        }