TypeAdapter.IsSubstitutableBy Method

Namespace
Kampute.DocToolkit.Metadata.Adapters
Assembly
  • Kampute.DocToolkit.dll

Definition

Determines whether the specified type as a parameter type can be substituted for the current type.
public virtual bool IsSubstitutableBy(IType other)

Parameters

other IType
The type to check against the current type.

Returns

bool
true if the specified type is substitutable for the current type; otherwise, false.

Remarks

This method is used to determine if two members have compatible signatures, such as when checking for method overrides or interface implementations.

The following conditions make the other type substitutable for the current type:

  • The current type and the other type represent the same type.
  • Both types are a decorated type (e.g., array, pointer, by-ref, or nullable) with identical modifiers and their element types are also satisfiable.
  • Both types are generic type parameters with identical constraints and declaring member ancestry.
  • The current type is a generic type parameter, and the other type is a type that satisfies all of its constraints.
For all other cases, the current type is not considered substitutable by the other type.