Redigera

Dela via


TypeName Class

Definition

public ref class TypeName sealed
public sealed class TypeName
type TypeName = class
Public NotInheritable Class TypeName
Inheritance
TypeName

Properties

AssemblyName

Returns assembly name that contains this type, or null if this TypeName was not

created from a fully qualified name.

AssemblyQualifiedName

Gets the assembly-qualified name of the type; for example, "System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089".

DeclaringType

If this type is a nested type (see IsNested), gets

the declaring type. If this type is not a nested type, throws.

FullName

Gets the full name of this type, including namespace, but without the assembly name; for example, "System.Int32".

Nested types are represented with a '+'; for example, "MyNamespace.MyType+NestedType".

IsArray

Gets a value that indicates whether this type represents any kind of array, regardless of the array's

rank or its bounds.

IsByRef

Gets a value that indicates whether this is a managed pointer type (for example, "ref int").

Managed pointer types are sometimes called byref types (IsByRef).

IsConstructedGenericType

Gets a value that indicates whether this type represents a constructed generic type (for example, "List<int>").

IsNested

Gets a value that indicates whether this is a nested type (for example, "Namespace.Declaring+Nested").

For nested types DeclaringType returns their declaring type.

IsPointer

Gets a value that indicates whether this type represents an unmanaged pointer (for example, "int*" or "void*").

Unmanaged pointer types are often just called pointers (IsPointer).

IsSimple

Gets a value that indicates whether this is a "plain" type; that is, not an array, not a pointer, not a reference, and

not a constructed generic type. Examples of elemental types are "System.Int32",

"System.Uri", and "YourNamespace.YourClass".

IsSZArray

Gets a value that indicates whether this type represents a single-dimensional, zero-indexed array (for example, "int[]").

IsVariableBoundArrayType

Gets a value that indicates whether this type represents a variable-bound array; that is, an array of rank greater

than 1 (for example, "int[,]") or a single-dimensional array that isn't necessarily zero-indexed.

Name

Gets the name of this type, without the namespace and the assembly name; for example, "Int32".

Nested types are represented without a '+'; for example, "MyNamespace.MyType+NestedType" is just "NestedType".

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetArrayRank()

Gets the number of dimensions in an array.

GetElementType()

Gets the TypeName of the object encompassed or referred to by the current array, pointer, or reference type.

GetGenericArguments()

If this TypeName represents a constructed generic type, returns an array

of all the generic arguments. Otherwise it returns an empty array.

GetGenericTypeDefinition()

Returns a TypeName object that represents a generic type name definition from which the current generic type name can be constructed.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetNodeCount()

Gets the total number of TypeName instances that are used to describe

this instance, including any generic arguments or underlying types.

GetType()

Gets the Type of the current instance.

(Inherited from Object)
MakeArrayTypeName(Int32)
MakeByRefTypeName()
MakeGenericTypeName(ImmutableArray<TypeName>)
MakePointerTypeName()
MakeSZArrayTypeName()
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
Parse(ReadOnlySpan<Char>, TypeNameParseOptions)

Parses a span of characters into a type name.

ToString()

Returns a string that represents the current object.

(Inherited from Object)
TryParse(ReadOnlySpan<Char>, TypeName, TypeNameParseOptions)

Tries to parse a span of characters into a type name.

WithAssemblyName(AssemblyNameInfo)

Applies to