ParameterAdapter.IsSatisfiableBy Method

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

Definition

Determines whether the specified parameter can be used in place of the current parameter.
public virtual bool IsSatisfiableBy(IParameter other)

Parameters

other IParameter
The parameter to compare against the current parameter.

Returns

bool
true if the specified parameter can be used in place of the current parameter; otherwise, false.

Remarks

This method evaluates type compatibility between parameters for scenarios such as method overrides, interface implementations, and overload resolution. The specified parameter can satisfy the current parameter if they have the same position and reference kind, and their types meet one of the following criteria:
  • Both types are identical.
  • Both types are decorated types (array, pointer, by-ref, or nullable) with identical modifiers and compatible element types.
  • Both types are generic type parameters with identical constraints and declaring member ancestry.
  • The current type is an open generic type parameter, and the specified type satisfies all of its constraints.
For return parameters of non-interface members, to support covariant return types in method overrides, the specified parameter can also satisfy the current parameter if any of the following conditions are met:
  • The specified parameter's type is a subclass of the current parameter's type.
  • The specified parameter's type implements the current parameter's interface type.
This method does not verify that the parameters belong to compatible members or contexts. The caller must ensure that the parameters are from related members, such as in method inheritance hierarchies.