Initial commit
[mono.git] / mcs / class / referencesource / mscorlib / system / runtime / interopservices / handleref.cs
1 // ==++==
2 // 
3 //   Copyright (c) Microsoft Corporation.  All rights reserved.
4 // 
5 // ==--==
6 namespace System.Runtime.InteropServices
7 {
8     
9     using System;
10
11     [System.Runtime.InteropServices.ComVisible(true)]
12     public struct HandleRef
13     {
14
15         // ! Do not add or rearrange fields as the EE depends on this layout.
16         //------------------------------------------------------------------
17         internal Object m_wrapper;
18         internal IntPtr m_handle;
19         //------------------------------------------------------------------
20
21
22         public HandleRef(Object wrapper, IntPtr handle)
23         {
24             m_wrapper = wrapper;
25             m_handle  = handle;
26         }
27
28         public Object Wrapper {
29             get {
30                 return m_wrapper;
31             }
32         }
33     
34         public IntPtr Handle {
35             get {
36                 return m_handle;
37             }
38         }
39     
40     
41         public static explicit operator IntPtr(HandleRef value)
42         {
43             return value.m_handle;
44         }
45
46         public static IntPtr ToIntPtr(HandleRef value)
47         {
48             return value.m_handle;
49         }
50     }
51 }