Line | |
---|
1 | '--------------------------------------------------------------------
|
---|
2 | ' Test case of GCHandle Class
|
---|
3 | '--------------------------------------------------------------------
|
---|
4 |
|
---|
5 | Namespace GCHandleTest
|
---|
6 |
|
---|
7 | Sub TestMain()
|
---|
8 | Imports System.Runtime.InteropServices
|
---|
9 |
|
---|
10 | Dim o = New Object
|
---|
11 | Dim gch = GCHandle.Alloc(o)
|
---|
12 | UnitTest("GCHandle.Alloc, Target", o.Equals(gch.Target))
|
---|
13 |
|
---|
14 | Dim ip = GCHandle.ToIntPtr(gch)
|
---|
15 | gch = Nothing
|
---|
16 |
|
---|
17 | gch = GCHandle.FromIntPtr(ip)
|
---|
18 | UnitTest("GCHandle - IntPtr", o.Equals(gch.Target))
|
---|
19 | End Sub
|
---|
20 |
|
---|
21 | End Namespace
|
---|
22 |
|
---|
23 | GCHandleTest.TestMain()
|
---|
Note:
See
TracBrowser
for help on using the repository browser.