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