Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DispatchWrapper Class

Wraps objects the marshaler should marshal as a VT_DISPATCH.

For a list of all members of this type, see DispatchWrapper Members.

System.Object
   System.Runtime.InteropServices.DispatchWrapper

[Visual Basic]
NotInheritable Public Class DispatchWrapper
[C#]
public sealed class DispatchWrapper
[C++]
public __gc __sealed class DispatchWrapper
[JScript]
public class DispatchWrapper

Thread Safety

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

Remarks

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.

[C#] 
void MyMethod(Object o);
 
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.

Requirements

Namespace: System.Runtime.InteropServices

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: Mscorlib (in Mscorlib.dll)

See Also

DispatchWrapper Members | System.Runtime.InteropServices Namespace

Show:
© 2017 Microsoft