byte[] buffer = new byte[1024]; // some random data GCHandle handle = GCHandle.Alloc(buffer, GCHandleType.Pinned); IntPtr ptr = handle.AddrOfPinnedObject(); // gets the address of the pinned object // do something with ptr handle.Free(); // frees the pinned objectIn this example, we allocate a byte array and pin it to the managed heap using GCHandleToPinnedArrayObject. We then get the address of the pinned object using AddrOfPinnedObject and perform some operation on that memory location. Finally, we free the pinned object using the Free method. This package/library is part of the .NET framework and does not require any external package installation.