Table of Contents

Interface ITypeParameter

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

Type parameter of a generic class/method.

public interface ITypeParameter : IType, INamedElement, IEquatable<IType>, ISymbol
Inherited Members
Extension Methods

Properties

EffectiveBaseClass

Gets the effective base class of this type parameter.

IType EffectiveBaseClass { get; }

Property Value

IType

EffectiveInterfaceSet

Gets the effective interface set of this type parameter.

IReadOnlyCollection<IType> EffectiveInterfaceSet { get; }

Property Value

IReadOnlyCollection<IType>

HasDefaultConstructorConstraint

Gets if the type parameter has the 'new()' constraint.

bool HasDefaultConstructorConstraint { get; }

Property Value

bool

HasReferenceTypeConstraint

Gets if the type parameter has the 'class' constraint.

bool HasReferenceTypeConstraint { get; }

Property Value

bool

HasUnmanagedConstraint

Gets if the type parameter has the 'unmanaged' constraint.

bool HasUnmanagedConstraint { get; }

Property Value

bool

HasValueTypeConstraint

Gets if the type parameter has the 'struct' or 'unmanaged' constraint.

bool HasValueTypeConstraint { get; }

Property Value

bool

Index

Gets the index of the type parameter in the type parameter list of the owning method/class.

int Index { get; }

Property Value

int

Name

Gets the name of the type parameter.

string Name { get; }

Property Value

string

NullabilityConstraint

Nullability of the reference type constraint. (e.g. "where T : class?").

Note that the nullability of a use of the type parameter may differ from this. E.g. "T? GetNull<T>() where T : class => null;"

Nullability NullabilityConstraint { get; }

Property Value

Nullability

Owner

Gets the owning method/class. This property may return null (for example for the dummy type parameters used by ReplaceMethodTypeParametersWithDummy).

IEntity? Owner { get; }

Property Value

IEntity

Remarks

For "class Outer<T> { class Inner {} }", inner.TypeParameters[0].Owner will be the outer class, because the same ITypeParameter instance is used both on Outer1 and Outer1+Inner.

OwnerType

Get the type of this type parameter's owner.

SymbolKind OwnerType { get; }

Property Value

SymbolKind

SymbolKind.TypeDefinition or SymbolKind.Method

TypeConstraints

IReadOnlyList<TypeConstraint> TypeConstraints { get; }

Property Value

IReadOnlyList<TypeConstraint>

Variance

Gets the variance of this type parameter.

VarianceModifier Variance { get; }

Property Value

VarianceModifier

Methods

GetAttributes()

Gets the attributes declared on this type parameter.

IEnumerable<IAttribute> GetAttributes()

Returns

IEnumerable<IAttribute>