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

◆ AddrOfPinnedObject()

unsafe IntPtr System.Runtime.InteropServices.GCHandle.AddrOfPinnedObject ( )
inline

Definition at line 98 of file GCHandle.cs.

99 {
102 if (!IsPinned(handle))
103 {
104 ThrowHelper.ThrowInvalidOperationException_HandleIsNotPinned();
105 }
107 if (obj == null)
108 {
109 return (IntPtr)0;
110 }
112 {
113 if (obj.GetType() == typeof(string))
114 {
115 return (IntPtr)Unsafe.AsPointer(ref Unsafe.As<string>(obj).GetRawStringData());
116 }
117 return (IntPtr)Unsafe.AsPointer(ref MemoryMarshal.GetArrayDataReference(Unsafe.As<Array>(obj)));
118 }
119 return (IntPtr)Unsafe.AsPointer(ref obj.GetRawData());
120 }
static unsafe bool ObjectHasComponentSize(object obj)
static bool IsPinned(IntPtr handle)
Definition GCHandle.cs:174
static void ThrowIfInvalid(IntPtr handle)
Definition GCHandle.cs:180
static IntPtr GetHandleValue(IntPtr handle)
Definition GCHandle.cs:168
static unsafe object InternalGet(IntPtr handle)
Definition GCHandle.cs:40

References System.Runtime.InteropServices.GCHandle._handle, System.Runtime.InteropServices.MemoryMarshal.GetArrayDataReference(), System.Runtime.InteropServices.GCHandle.GetHandleValue(), System.handle, System.Runtime.InteropServices.GCHandle.InternalGet(), System.Runtime.InteropServices.GCHandle.IsPinned(), System.obj, System.Runtime.CompilerServices.RuntimeHelpers.ObjectHasComponentSize(), System.Runtime.InteropServices.GCHandle.ThrowIfInvalid(), and System.ThrowHelper.ThrowInvalidOperationException_HandleIsNotPinned().

Referenced by System.Net.WebSockets.WebSocketBuffer.CreateProperties(), System.Diagnostics.Tracing.DataCollector.PinArray(), Microsoft.Xna.Framework.Helpers.SmartGetHashCode(), and System.Security.Principal.SecurityIdentifier.TranslateToNTAccounts().