Rev | Line | |
---|
[230] | 1 | '--------------------------------------------------------------------
|
---|
| 2 | ' Test case of GCHandle Class
|
---|
| 3 | '--------------------------------------------------------------------
|
---|
| 4 |
|
---|
| 5 | Namespace GCHandleTest
|
---|
| 6 |
|
---|
| 7 | Sub TestMain()
|
---|
[383] | 8 | Imports System.Runtime.InteropServices
|
---|
| 9 |
|
---|
[230] | 10 | Dim o = New Object
|
---|
[383] | 11 | Dim gch = GCHandle.Alloc(o)
|
---|
[230] | 12 | UnitTest("GCHandle.Alloc, Target", o.Equals(gch.Target))
|
---|
| 13 |
|
---|
[383] | 14 | Dim ip = GCHandle.ToIntPtr(gch)
|
---|
[230] | 15 | gch = Nothing
|
---|
| 16 |
|
---|
[383] | 17 | gch = GCHandle.FromIntPtr(ip)
|
---|
[230] | 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.