IDynamicInterfaceCastable.IsInterfaceImplemented Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Called when an implementing class instance is cast to an interface type that is not contained in the class's metadata.
public:
bool IsInterfaceImplemented(RuntimeTypeHandle interfaceType, bool throwIfNotImplemented);
public bool IsInterfaceImplemented (RuntimeTypeHandle interfaceType, bool throwIfNotImplemented);
abstract member IsInterfaceImplemented : RuntimeTypeHandle * bool -> bool
Public Function IsInterfaceImplemented (interfaceType As RuntimeTypeHandle, throwIfNotImplemented As Boolean) As Boolean
Parameters
- interfaceType
- RuntimeTypeHandle
The interface type.
- throwIfNotImplemented
- Boolean
Indicates if the function should throw an exception instead of returning false
.
Returns
true
if this object can be cast to the given interface; otherwise, false
.
Remarks
This is called if casting this object to the given interface type would otherwise fail. Casting here means the IL isinst
and castclass
instructions in the case where they are given an interface type as the target type.
If throwIfNotImplemented
is false
, this function should avoid throwing exceptions. If throwIfNotImplemented
is true
and this function returns false
, then InvalidCastException will be thrown unless an exception is thrown by the implementation.