using System; using System.Runtime.InteropServices; using System.Runtime.Serialization; namespace System.Reflection { /// Provides a wrapper class for pointers. // Token: 0x02000264 RID: 612 [CLSCompliant(false)] [ComVisible(true)] [Serializable] public sealed class Pointer : ISerializable { // Token: 0x06001FBD RID: 8125 RVA: 0x00074430 File Offset: 0x00072630 private Pointer() { } /// Sets the object with the file name, fusion log, and additional exception information. /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. // Token: 0x06001FBE RID: 8126 RVA: 0x00074438 File Offset: 0x00072638 void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { throw new NotSupportedException("Pointer deserializatioon not supported."); } /// Boxes the supplied unmanaged memory pointer and the type associated with that pointer into a managed wrapper object. The value and the type are saved so they can be accessed from the native code during an invocation. /// A pointer object. /// The supplied unmanaged memory pointer. /// The type associated with the parameter. /// /// is not a pointer. /// /// is null. // Token: 0x06001FBF RID: 8127 RVA: 0x00074444 File Offset: 0x00072644 public unsafe static object Box(void* ptr, Type type) { if (type == null) { throw new ArgumentNullException("type"); } if (!type.IsPointer) { throw new ArgumentException("type"); } return new Pointer { data = ptr, type = type }; } /// Returns the stored pointer. /// This method returns void. /// The stored pointer. /// /// is not a pointer. // Token: 0x06001FC0 RID: 8128 RVA: 0x00074490 File Offset: 0x00072690 public unsafe static void* Unbox(object ptr) { Pointer pointer = ptr as Pointer; if (pointer == null) { throw new ArgumentException("ptr"); } return pointer.data; } // Token: 0x04000AFF RID: 2815 private unsafe void* data; // Token: 0x04000B00 RID: 2816 private Type type; } }