Welcome to mirror list, hosted at ThFree Co, Russian Federation.

HandleRef.cs « InteropServices « Runtime « System « shared « System.Private.CoreLib « src - github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c81a701996bb53270e27e188b750cc06f63424fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

namespace System.Runtime.InteropServices
{
    public readonly struct HandleRef
    {
        // ! Do not add or rearrange fields as the EE depends on this layout.
        //------------------------------------------------------------------
        private readonly object _wrapper;
        private readonly IntPtr _handle;
        //------------------------------------------------------------------

        public HandleRef(object wrapper, IntPtr handle)
        {
            _wrapper = wrapper;
            _handle = handle;
        }

        public object Wrapper
        {
            get
            {
                return _wrapper;
            }
        }

        public IntPtr Handle
        {
            get
            {
                return _handle;
            }
        }

        public static explicit operator IntPtr(HandleRef value)
        {
            return value._handle;
        }

        public static IntPtr ToIntPtr(HandleRef value)
        {
            return value._handle;
        }
    }
}