GCHandle

GCHandle CF 1.0, ECMA 1.0

System.Runtime.InteropServices (mscorlib.dll) struct

This class is used when you need to pass a managed object to unmanaged code. To use this class, pass an instance of a .NET-managed type to the Alloc( ) method. The single-argument form of Alloc( ) creates the GCHandle with GCHandleType.Normal , which ensures that the object will not be freed by the garbage collector. (This means that some kind of user code must also call the Free( ) method in order to release the object.) Managed code can use the Target property to access the underlying object.

 public struct  GCHandle  {  // Public Instance Properties  public bool  IsAllocated  {get; }    public object  Target  {set; get; }  // Public Static Methods  public static GCHandle  Alloc  (object   value   );    public static GCHandle  Alloc  (object   value   , GCHandleType   type   );    public static explicit operator  GCHandle  (IntPtr   value   );    public static explicit operator  IntPtr  (GCHandle   value   );  // Public Instance Methods  public IntPtr  AddrOfPinnedObject  ( );    public void  Free  ( ); } 

Hierarchy

System.Object System.ValueType GCHandle



C# in a Nutshell
C # in a Nutshell, Second Edition
ISBN: 0596005261
EAN: 2147483647
Year: 2005
Pages: 963

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net