Table of Contents

Interface ITypeDefinition

Namespace
ICSharpCode.Decompiler.TypeSystem
Assembly
ICSharpCode.Decompiler.dll

Represents a class, enum, interface, struct, delegate, record or VB module. For partial classes, this represents the whole class.

public interface ITypeDefinition : ITypeDefinitionOrUnknown, IType, IEquatable<IType>, IEntity, INamedElement, ISymbol, ICompilationProvider
Inherited Members
Extension Methods

Properties

DeclaringType

Gets/Sets the declaring type (incl. type arguments, if any). This property will return null for top-level types.

IType? DeclaringType { get; }

Property Value

IType

EnumUnderlyingType

For enums: returns the underlying primitive type. For all other types: returns null.

IType? EnumUnderlyingType { get; }

Property Value

IType

Events

IEnumerable<IEvent> Events { get; }

Property Value

IEnumerable<IEvent>

Fields

IEnumerable<IField> Fields { get; }

Property Value

IEnumerable<IField>

HasExtensionMethods

Gets whether this type contains extension methods.

bool HasExtensionMethods { get; }

Property Value

bool

Remarks

This property is used to speed up the search for extension methods.

IsReadOnly

For structs: returns whether this is a readonly struct. For all other types: returns false.

bool IsReadOnly { get; }

Property Value

bool

IsRecord

Gets whether the type has the necessary members to be considered a C# 9 record or C# 10 record struct type.

bool IsRecord { get; }

Property Value

bool

KnownTypeCode

Gets the known type code for this type definition.

KnownTypeCode KnownTypeCode { get; }

Property Value

KnownTypeCode

Members

IReadOnlyList<IMember> Members { get; }

Property Value

IReadOnlyList<IMember>

MetadataName

Gets the short type name as stored in metadata. That is, the short type name including the generic arity (`N) appended.

string MetadataName { get; }

Property Value

string

Remarks

"Int32" for int "List1" for List<T> "List1" for List<string>

Methods

IEnumerable<IMethod> Methods { get; }

Property Value

IEnumerable<IMethod>

NestedTypes

IReadOnlyList<ITypeDefinition> NestedTypes { get; }

Property Value

IReadOnlyList<ITypeDefinition>

NullableContext

The nullability specified in the [NullableContext] attribute on the type. This serves as default nullability for members of the type that do not have a [Nullable] attribute.

Nullability NullableContext { get; }

Property Value

Nullability

Properties

IEnumerable<IProperty> Properties { get; }

Property Value

IEnumerable<IProperty>