Rev | Line | |
---|
[230] | 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
|
---|
[283] | 11 | Dim gch = System.Runtime.InteropServices.GCHandle.Alloc(o)
|
---|
[230] | 12 | UnitTest("GCHandle.Alloc, Target", o.Equals(gch.Target))
|
---|
| 13 |
|
---|
[283] | 14 | Dim ip = System.Runtime.InteropServices.GCHandle.ToIntPtr(gch)
|
---|
[230] | 15 | gch = Nothing
|
---|
| 16 |
|
---|
[283] | 17 | gch = System.Runtime.InteropServices.GCHandle.FromIntPtr(ip)
|
---|
[230] | 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.