IsAllocated Property
Collapse the table of content
Expand the table of content

GCHandle.IsAllocated Property

Gets a value indicating whether the handle is allocated.

[Visual Basic]
Public ReadOnly Property IsAllocated As Boolean
[C#]
public bool IsAllocated {get;}
[C++]
public: __property bool get_IsAllocated();
[JScript]
public function get IsAllocated() : Boolean;

Property Value

true if the handle is allocated; otherwise, false.

Remarks

Use this property when using Weak handles to determine if the GCHandle is still available. When the garbage collector collects the object, the Weak handle can still be resurrected in the finalizer. In that case, the handle is not allocated (it is lost when the garbage collector attempts to collect the object), even though the target object is valid.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

GCHandle Structure | GCHandle Members | System.Runtime.InteropServices Namespace | GCHandleType

Show:
© 2016 Microsoft