'-------------------------------------------------------------------- ' Test case of GCHandle Class '-------------------------------------------------------------------- Namespace GCHandleTest Sub TestMain() Imports System.Runtime.InteropServices Dim o = New Object Dim gch = GCHandle.Alloc(o) UnitTest("GCHandle.Alloc, Target", o.Equals(gch.Target)) Dim ip = GCHandle.ToIntPtr(gch) gch = Nothing gch = GCHandle.FromIntPtr(ip) UnitTest("GCHandle - IntPtr", o.Equals(gch.Target)) End Sub End Namespace GCHandleTest.TestMain()