EnumerableToDispatchMarshaler Class

 

Marshals the COM IDispatch interface to the .NET Framework IEnumerable interface, and vice versa.

Namespace:   System.Runtime.InteropServices.CustomMarshalers
Assembly:  CustomMarshalers (in CustomMarshalers.dll)

System.Object
  System.Runtime.InteropServices.CustomMarshalers.EnumerableToDispatchMarshaler

public class EnumerableToDispatchMarshaler : ICustomMarshaler

NameDescription
System_CAPS_pubmethodCleanUpManagedData(Object)

Performs necessary cleanup of the managed data when it is no longer needed.

System_CAPS_pubmethodCleanUpNativeData(IntPtr)

Performs necessary cleanup of the unmanaged data when it is no longer needed.

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodSystem_CAPS_staticGetInstance(String)

Returns an instance of the custom marshaler.

System_CAPS_pubmethodGetNativeDataSize()

Returns the size in bytes of the unmanaged data to be marshaled.

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodMarshalManagedToNative(Object)

Marshals an object from managed code to unmanaged code.

System_CAPS_pubmethodMarshalNativeToManaged(IntPtr)

Marshals an object from unmanaged code to managed code.

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

This custom marshaler marshals IDispatch to IEnumerable and marshals IEnumerable to IDispatch when a member with a DISPID of -4 exists. When you use the Type Library Importer (Tlbimp.exe) to create a class that implements IEnumerable , the CLR uses this custom marshaler automatically to bridge COM enumerators and .NET enumerators. Calling GetEnumerator results in IDispatch.Invoke being called with a DISPID of -4, and vice versa.

.NET Framework
Available since 1.1

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: