Struct FullTypeName
- Namespace
- ICSharpCode.Decompiler.TypeSystem
- Assembly
- ICSharpCode.Decompiler.dll
Holds the full name of a type definition. A full type name uniquely identifies a type definition within a single assembly.
public readonly struct FullTypeName : IEquatable<FullTypeName>
- Implements
- Inherited Members
- Extension Methods
Remarks
A full type name can only represent type definitions, not arbitrary types. It does not include any type arguments, and can not refer to array or pointer types.
A full type name represented as reflection name has the syntax:
NamespaceName '.' TopLevelTypeName ['
'#] { '+' NestedTypeName ['
'#] }
Constructors
FullTypeName(TopLevelTypeName)
Constructs a FullTypeName representing the given top-level type.
public FullTypeName(TopLevelTypeName topLevelTypeName)
Parameters
topLevelTypeName
TopLevelTypeName
Remarks
FullTypeName has an implicit conversion operator from TopLevelTypeName,
so you can simply write:
FullTypeName f = new TopLevelTypeName(...);
FullTypeName(string)
Constructs a FullTypeName by parsing the given reflection name. Note that FullTypeName can only represent type definition names. If the reflection name might refer to a parameterized type or array etc., use ParseReflectionName(string) instead.
public FullTypeName(string reflectionName)
Parameters
reflectionName
string
Remarks
Expected syntax: NamespaceName '.' TopLevelTypeName ['
where # are type parameter counts'#] { '+' NestedTypeName ['
'#] }
Properties
IsNested
Gets whether this is a nested type.
public bool IsNested { get; }
Property Value
Name
Gets the name of the type. For nested types, this is the name of the innermost type.
public string Name { get; }
Property Value
NestingLevel
Gets the nesting level.
public int NestingLevel { get; }
Property Value
ReflectionName
public string ReflectionName { get; }
Property Value
TopLevelTypeName
Gets the top-level type name.
public TopLevelTypeName TopLevelTypeName { get; }
Property Value
TypeParameterCount
Gets the total type parameter count.
public int TypeParameterCount { get; }
Property Value
Methods
Equals(FullTypeName)
public bool Equals(FullTypeName other)
Parameters
other
FullTypeName
Returns
Equals(object)
public override bool Equals(object obj)
Parameters
obj
object
Returns
GetDeclaringType()
Gets the declaring type name.
public FullTypeName GetDeclaringType()
Returns
Examples
new FullTypeName("NS.A+B+C").GetDeclaringType()
will return new FullTypeName("NS.A+B")
Exceptions
- InvalidOperationException
This is a top-level type name.
GetHashCode()
public override int GetHashCode()
Returns
GetNestedTypeAdditionalTypeParameterCount(int)
Gets the number of additional type parameters of the nested type at the given level.
public int GetNestedTypeAdditionalTypeParameterCount(int nestingLevel)
Parameters
nestingLevel
int
Returns
GetNestedTypeName(int)
Gets the name of the nested type at the given level.
public string GetNestedTypeName(int nestingLevel)
Parameters
nestingLevel
int
Returns
NestedType(string, int)
Creates a nested type name.
public FullTypeName NestedType(string name, int additionalTypeParameterCount)
Parameters
Returns
Examples
new FullTypeName("NS.A+B").NestedType("C", 1)
will return new FullTypeName("NS.A+B+C`1")
ToString()
public override string ToString()
Returns
Operators
operator ==(FullTypeName, FullTypeName)
public static bool operator ==(FullTypeName left, FullTypeName right)
Parameters
left
FullTypeNameright
FullTypeName
Returns
implicit operator FullTypeName(TopLevelTypeName)
public static implicit operator FullTypeName(TopLevelTypeName topLevelTypeName)
Parameters
topLevelTypeName
TopLevelTypeName
Returns
operator !=(FullTypeName, FullTypeName)
public static bool operator !=(FullTypeName left, FullTypeName right)
Parameters
left
FullTypeNameright
FullTypeName