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
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
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
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
Returns
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
TypeParameterSubstitutionnormalization
TypeVisitor
Returns
Equals(object)
public override bool Equals(object obj)
Parameters
obj
object
Returns
GetHashCode()
public override int GetHashCode()
Returns
ToString()
public override string ToString()
Returns
VisitNullabilityAnnotatedType(NullabilityAnnotatedType)
public override IType VisitNullabilityAnnotatedType(NullabilityAnnotatedType type)
Parameters
Returns
VisitTypeParameter(ITypeParameter)
public override IType VisitTypeParameter(ITypeParameter type)
Parameters
type
ITypeParameter