DispatchWrapper Class

 

Wraps objects the marshaler should marshal as a VT_DISPATCH.

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

System.Object
  System.Runtime.InteropServices.DispatchWrapper

[SerializableAttribute]
[ComVisibleAttribute(true)]
public sealed class DispatchWrapper

NameDescription
System_CAPS_pubmethodDispatchWrapper(Object)

Initializes a new instance of the DispatchWrapper class with the object being wrapped.

NameDescription
System_CAPS_pubpropertyWrappedObject

Gets the object wrapped by the DispatchWrapper.

NameDescription
System_CAPS_pubmethodEquals(Object)

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

System_CAPS_pubmethodGetHashCode()

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

System_CAPS_pubmethodGetType()

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

System_CAPS_pubmethodToString()

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

Use to wrap objects the marshaler should marshal as a VT_DISPATCH. This wrapper will force objects to be marshaled out as VT_DISPATCH. If the object does not support IDispatch then an exception will be thrown.

void MyMethod(Object o);

public void DoWrap()
{
    Object o = new MyObject();
    MyMethod(o);                      // passes o as VT_UNKNOWN
    MyMethod(new DispatchWrapper(o)); // passes o as VT_DISPATCH

    //...
}

For more information on VT_DISPATCH, please see the existing documentation for VARENUM::VT_DISPATCH in the MSDN library.

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Windows Phone
Available since 8.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: