3 // Copyright (c) Microsoft Corporation. All rights reserved.
6 /*=============================================================================
8 ** Class: DispatchWrapper.
11 ** Purpose: Wrapper that is converted to a variant with VT_DISPATCH.
14 =============================================================================*/
16 namespace System.Runtime.InteropServices {
19 using System.Security;
20 using System.Security.Permissions;
23 [System.Runtime.InteropServices.ComVisible(true)]
24 public sealed class DispatchWrapper
26 [System.Security.SecuritySafeCritical] // auto-generated
27 #pragma warning disable 618
28 [SecurityPermissionAttribute(SecurityAction.Demand,Flags=SecurityPermissionFlag.UnmanagedCode)]
29 #pragma warning restore 618
30 public DispatchWrapper(Object obj)
34 // Make sure this guy has an IDispatch
35 IntPtr pdisp = Marshal.GetIDispatchForObject(obj);
37 // If we got here without throwing an exception, the QI for IDispatch succeeded.
38 Marshal.Release(pdisp);
40 m_WrappedObject = obj;
43 public Object WrappedObject
47 return m_WrappedObject;
51 private Object m_WrappedObject;