blob: 075d78f2416733e9f81081ba70a479fcd772b027 (
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
|
// 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 => _wrapper;
public IntPtr Handle => _handle;
public static explicit operator IntPtr(HandleRef value) => value._handle;
public static IntPtr ToIntPtr(HandleRef value) => value._handle;
}
}
|