NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

WeakReference.IsAlive

Retrieves a Boolean that indicates whether GC has occurred on the object.

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

Property Value

Read only. This property can have the following values:

Value Description
true The object is still accessible.
false Otherwise.

Exceptions

Exception Type Condition
WeakReferenceException If the object reference encapsulated by the current instance is invalid.

Remarks

The Is Alive property retrieves a Boolean that indicates whether the current instance of WeakReference still refers to an object that has or has not been collected by the garbage collector (GC) yet.

If IsAlive returns true, the Target property will return a valid reference to the object. On the other hand, if IsAlive returns false, Target returns null.

A WeakReferenceException is thown if the the object reference encapsulated by the current instance is invalid. This will occur if the current instance has been resurrected after a call to Finalize because Finalize destroys the underlying reference.

See Also

WeakReference Class | WeakReference Members | System Namespace | GC | GCHandle | Object