Marshaling Selected Interfaces
The primary goal of the runtime callable wrapper (RCW) is to hide the differences between the managed and unmanaged programming models. To create a seamless transition, the RCW consumes selected COM interfaces without exposing them to the .NET client, as shown in the following illustration.
When created as an early-bound object, the RCW is a specific type. It implements the interfaces that the COM object implements and exposes the methods, properties, and events from the object's interfaces. In the illustration, the RCW exposes the INew interface but consumes the IUnknown and IDispatch interfaces. Further, the RCW exposes all members of the INew interface to the .NET client.
The RCW consumes the interfaces listed in the following table, which are exposed by the object it wraps.
For late binding to COM objects through reflection.
Provides a textual description of the error, its source, a Help file, Help context, and the GUID of the interface that defined the error (always GUID_NULL for .NET classes).
If the COM object being wrapped implements IProvideClassInfo, the RCW extracts the type information from this interface to provide better type identity.
For object identity, type coercion, and lifetime management:
The RCW optionally consumes the interfaces listed in the following table, which are exposed by the object it wraps.
IConnectionPoint and IConnectionPointContainer
The RCW converts objects that expose the connection-point event style to delegate-based events.
If the class implements IDispatchEx, the RCW implements IExpando. The IDispatchEx interface is an extension of the IDispatch interface that, unlike IDispatch, enables enumeration, addition, deletion, and case-sensitive calling of members.
Enables COM types that support enumerations to be treated as collections.