src/TypeCatalogGen/TypeCatalogGen.cs
/// <summary>
/// Get the full name of a Type.
/// </summary>
Get the full name of a Type.
Get the full name of a Type .
private static string GetTypeFullName(MetadataReader metadataReader, TypeDefinition typeDefinition)
        {
            string fullName;
            string typeName = metadataReader.GetString(typeDefinition.Name);
            string nsName = metadataReader.GetString(typeDefinition.Namespace);
            TypeDefinitionHandle declaringTypeHandle = typeDefinition.GetDeclaringType();
            if (declaringTypeHandle.IsNil)
            {
                fullName = string.Format(CultureInfo.InvariantCulture, "{0}.{1}", nsName, typeName);
            }
            else
            {
                fullName = typeName;
                while (!declaringTypeHandle.IsNil)
                {
                    TypeDefinition declaringTypeDef = metadataReader.GetTypeDefinition(declaringTypeHandle);
                    declaringTypeHandle = declaringTypeDef.GetDeclaringType();
                    if (declaringTypeHandle.IsNil)
                    {
                        fullName = string.Format(CultureInfo.InvariantCulture, "{0}.{1}+{2}",
                                                 metadataReader.GetString(declaringTypeDef.Namespace),
                                                 metadataReader.GetString(declaringTypeDef.Name),
                                                 fullName);
                    }
                    else
                    {
                        fullName = string.Format(CultureInfo.InvariantCulture, "{0}+{1}",
                                                 metadataReader.GetString(declaringTypeDef.Name),
                                                 fullName);
                    }
                }
            }
            return fullName;
        }
private static string GetTypeFullName ( MetadataReader metadataReader , TypeDefinition typeDefinition ) { string fullName ; string typeName = metadataReader . GetString ( typeDefinition . Name ) ; string nsName = metadataReader . GetString ( typeDefinition . Namespace ) ; TypeDefinitionHandle declaringTypeHandle = typeDefinition . GetDeclaringType ( ) ; if ( declaringTypeHandle . IsNil ) { fullName = string . Format ( CultureInfo . InvariantCulture , " " , nsName , typeName ) ; } else { fullName = typeName ; while ( ! declaringTypeHandle . IsNil ) { TypeDefinition declaringTypeDef = metadataReader . GetTypeDefinition ( declaringTypeHandle ) ; declaringTypeHandle = declaringTypeDef . GetDeclaringType ( ) ; if ( declaringTypeHandle . IsNil ) { fullName = string . Format ( CultureInfo . InvariantCulture , " " , metadataReader . GetString ( declaringTypeDef . Namespace ) , metadataReader . GetString ( declaringTypeDef . Name ) , fullName ) ; } else { fullName = string . Format ( CultureInfo . InvariantCulture , " " , metadataReader . GetString ( declaringTypeDef . Name ) , fullName ) ; } } } return fullName ; }
Get the full name of a Type.
Get the full name of a Type .
// Get the enclosing type if the type is nested
metadataReader
MetadataReader
typeDefinition
TypeDefinition