Table of Contents

Class TypeParameterSubstitution

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

Substitutes class and method type parameters.

public class TypeParameterSubstitution : TypeVisitor
Inheritance
TypeParameterSubstitution
Inherited Members

Constructors

TypeParameterSubstitution(IReadOnlyList<IType>, IReadOnlyList<IType>)

Creates a new type parameter substitution.

public TypeParameterSubstitution(IReadOnlyList<IType> classTypeArguments, IReadOnlyList<IType> methodTypeArguments)

Parameters

classTypeArguments IReadOnlyList<IType>

The type arguments to substitute for class type parameters. Pass null to keep class type parameters unmodified.

methodTypeArguments IReadOnlyList<IType>

The type arguments to substitute for method type parameters. Pass null to keep method type parameters unmodified.

Fields

Identity

The identity function.

public static readonly TypeParameterSubstitution Identity

Field Value

TypeParameterSubstitution

Properties

ClassTypeArguments

Gets the list of class type arguments. Returns null if this substitution keeps class type parameters unmodified.

public IReadOnlyList<IType> ClassTypeArguments { get; }

Property Value

IReadOnlyList<IType>

MethodTypeArguments

Gets the list of method type arguments. Returns null if this substitution keeps method type parameters unmodified.

public IReadOnlyList<IType> MethodTypeArguments { get; }

Property Value

IReadOnlyList<IType>

Methods

Compose(TypeParameterSubstitution, TypeParameterSubstitution)

Computes a single TypeParameterSubstitution so that for all types t: t.AcceptVisitor(Compose(g, f)) equals t.AcceptVisitor(f).AcceptVisitor(g)

public static TypeParameterSubstitution Compose(TypeParameterSubstitution g, TypeParameterSubstitution f)

Parameters

g TypeParameterSubstitution
f TypeParameterSubstitution

Returns

TypeParameterSubstitution

Remarks

If you consider type parameter substitution to be a function, this is function composition.

Equals(TypeParameterSubstitution, TypeVisitor)

public bool Equals(TypeParameterSubstitution other, TypeVisitor normalization)

Parameters

other TypeParameterSubstitution
normalization TypeVisitor

Returns

bool

Equals(object)

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

ToString()

public override string ToString()

Returns

string

VisitNullabilityAnnotatedType(NullabilityAnnotatedType)

public override IType VisitNullabilityAnnotatedType(NullabilityAnnotatedType type)

Parameters

type NullabilityAnnotatedType

Returns

IType

VisitTypeParameter(ITypeParameter)

public override IType VisitTypeParameter(ITypeParameter type)

Parameters

type ITypeParameter

Returns

IType