AdapterHelper.IsSubstitutableBy Method
- Namespace
- Kampute.DocToolkit.Metadata.Adapters
- Assembly
- Kampute.DocToolkit.dll
Definition
Determines whether a target type can substitute a source type, where the generic type parameters of a type that appear in the source type, also within arrays, pointers, by-ref and nullable types, or as type arguments of constructed generic types, can be substituted by any type that satisfies their constraints.
public static bool IsSubstitutableBy(IType sourceType, IType targetType)Parameters
sourceTypeIType- The type used by the base declaration.
targetTypeIType- The type used by the derived or implementing declaration.
Returns
Exceptions
- ArgumentNullException
- Thrown when
sourceTypeortargetTypeisnull.

List<T>of a base declaration can be substituted byList<string>of an overriding declaration whenstringsatisfies the constraints ofT. Types that do not involve generic type parameters must be equal.