In this example, a GCHandle is allocated on the string variable `sampleStr` and is pinned in the memory. The handle is released using the GCHandle.Free method after using the pinned object. Example 2:csharp // Allocating GCHandle on an int array int[] numbers = new int[] { 1, 2, 3, 4, 5 }; GCHandle handle = GCHandle.Alloc(numbers, GCHandleType.Pinned); // using the pinned object // Freeing up the handle of the object handle.Free(); ``` In this example, a GCHandle is allocated on the `numbers` array and is pinned in the memory. The handle is released using the GCHandle.Free method after using the pinned object. The GCHandle.Free method is a part of the System.Runtime.InteropServices namespace in the .NET Framework library.