Table of Contents

API reference

The API of the support code that the generated code calls, from two NuGet packages:

  • CsCom.Runtime (CsCom.Runtime): the COM interfaces, the marshallers, the late-bound wrappers and the events. The generated projects reference it with the default --support-code package, and CsCom.Build depends on it.
  • CsCom.Runtime.Dynamic (CsCom.Runtime.Dynamic): the late binding with C# dynamic, see Late binding with dynamic. It extends the types of CsCom.Runtime, so it shares its namespace.

Both declare their types in the CsCom.Runtime namespace, and both target .NET 10 and .NET 11 with the same API. With --support-code public or internal, the same types are emitted into the generated project instead, in the <RootNamespace>.ComSupport namespace, see Support code.

Activation

Type Description
ComActivator Creates COM objects by CLSID or ProgID, gets running instances and binds monikers, as shared or unique objects.
ClassContext The execution contexts in which a COM class can be activated (CLSCTX).

COM interfaces

Type Description
IDispatch The OLE Automation IDispatch interface, which dual interfaces derive from.
IEnumVARIANT The IEnumVARIANT interface of the _NewEnum members of collections.
ComEnumerator Enumerates an IEnumVARIANT as an IEnumerator<object?>.
IConnectionPointContainer, IConnectionPoint The interfaces through which event sinks are connected.
IProvideClassInfo Gives the type information of the coclass of an object.

Interface pointers

Type Description
ComMarshalling Configures and performs the conversion of interface pointers: your own ComWrappers, releasing unique objects. See Interface pointers.
ComObjectMarshaller<T>, UniqueComObjectMarshaller<T> Marshal COM interfaces as shared objects (one per COM object) or unique objects (one per interface pointer).
DispatchWrapperMarshaller<T>, UniqueDispatchWrapperMarshaller<T> Marshal late-bound dispinterface wrappers as IDispatch pointers.

Values

Type Description
VariantMarshaller, OptionalVariantMarshaller Marshal object values as VARIANTs.
ComBstr, ComBstrMarshaller A BSTR accessed in place, for --bstr-marshalling wrapper, see BSTRs.
ComBstrValue A BSTR field of a structure, see Structures.
SafeArrayMarshaller<T>, SafeArrayMarshaller, UnknownSafeArrayMarshaller Marshal .NET arrays as SAFEARRAYs, see SAFEARRAYs.
ComSafeArray<T>, ComSafeArrayMarshaller<T> A SAFEARRAY of any rank with its native bounds, for --safearray-marshalling wrapper.
ComDate, ComCurrency, ComBool DATE, CURRENCY and VARIANT_BOOL with the layout of the COM types, for the wrapper marshalling options.
DateMarshaller, CurrencyMarshaller Marshal DateTime and decimal as DATE and CURRENCY.

Late binding

Type Description
DispatchObject The base class of the late-bound wrappers generated for dispinterfaces.
IDispatchProvider, IDispatchWrapper<TSelf> Implemented by the objects that wrap an IDispatch, such as the late-bound wrappers.
ComDispatch Resolves and invokes members through IDispatch by name or DISPID, for objects without a generated wrapper, and reads their type information.
DispatchArgumentKind, DispatchFlags, DispatchMemberKinds, DispIds The arguments, invocation kinds, member kinds and well-known DISPIDs of ComDispatch.
DispParams, ExcepInfo The OLE Automation DISPPARAMS and EXCEPINFO structures.

Events

Type Description
EventConnection Connects an event sink to a connection point and disconnects it, see Events.
EventGate The gate of a connection, through which a sink passes events to its handler.
DispatchEventSink, IDispatchEventHandler, EventArguments Receive the events of dispinterfaces through IDispatch::Invoke.
EventSubject<T>, EventSubject The hot observables of the event sinks generated with --event-style observable.
EventInterface, EventMember The source dispinterfaces of a coclass and their events, from ComDispatch.GetEventInterfaces.

Late binding with dynamic (CsCom.Runtime.Dynamic)

Type Description
ComDynamic AsDynamic, ToDynamic, the events of dynamic objects, and the extension members of ComActivator such as CreateDynamicInstance and GetActiveDynamicInstance.
DynamicDispatchObject The dynamic object of a COM object, which resolves members by name with IDispatch::GetIDsOfNames.