Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GCHandle() [1/2]

System.Runtime.InteropServices.GCHandle.GCHandle ( object value,
GCHandleType type )
inlineprivate

Definition at line 51 of file GCHandle.cs.

52 {
53 switch (type)
54 {
55 default:
56 throw new ArgumentOutOfRangeException("type", SR.ArgumentOutOfRange_Enum);
57 case GCHandleType.Pinned:
58 if (!Marshal.IsPinnable(value))
59 {
60 throw new ArgumentException(SR.ArgumentException_NotIsomorphic, "value");
61 }
62 break;
63 case GCHandleType.Weak:
64 case GCHandleType.WeakTrackResurrection:
65 case GCHandleType.Normal:
66 break;
67 }
68 nint num = InternalAlloc(value, type);
69 if (type == GCHandleType.Pinned)
70 {
71 num |= 1;
72 }
73 _handle = num;
74 }
static IntPtr InternalAlloc(object value, GCHandleType type)

References System.Runtime.InteropServices.GCHandle._handle, System.SR.ArgumentException_NotIsomorphic, System.SR.ArgumentOutOfRange_Enum, System.Runtime.InteropServices.GCHandle.InternalAlloc(), System.Runtime.InteropServices.Marshal.IsPinnable(), System.type, and System.value.

Referenced by System.Runtime.InteropServices.GCHandle.Alloc(), System.Runtime.InteropServices.GCHandle.Alloc(), System.Runtime.InteropServices.GCHandle.Equals(), and System.Runtime.InteropServices.GCHandle.FromIntPtr().