AdapterHelper.IsValidTypeSubstitution Method
- Namespace
- Kampute.DocToolkit.Metadata.Adapters
- Assembly
- Kampute.DocToolkit.dll
Definition
Determines whether a target type is a valid substitution for a source type in the context of method overriding or interface implementation.
public static bool IsValidTypeSubstitution(
IMember baseMember,
IType sourceType,
IMember derivedMember,
IType targetType)Parameters
baseMemberIMember- The base declaration of the member.
sourceTypeIType- The type used by the base declaration that may be substituted.
derivedMemberIMember- The derived or implementing declaration of the member.
targetTypeIType- The type used by the derived or implementing declaration that may substitute
sourceType.
Returns
Exceptions
- ArgumentNullException
- Thrown when any argument is
null.
Remarks
When both members have declaring types, generic type parameters are matched against the actual type arguments in the derived member's declaring type, base types, and implemented interfaces. An unresolved parameter must remain the same parameter; satisfying its constraints alone does not establish a matching signature. When declaring type information is unavailable, the comparison uses IsSubstitutableBy(IType, IType).
