Name

Pointer

Synopsis

This class allows access to direct pointers to .NET objects through two static methods. Unbox() returns a void* pointer to the passed object and pins it, not allowing the garbage collector to move its place in memory, and Box() returns control over the object to the .NET runtime.

public sealed class Pointer : System.Runtime.Serialization.ISerializable {
// Public Static Methods
   public static method object Box(void *ptr, Type type);  
   public static method void* Unbox(object ptr);  
}

Get C# in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.