Export (0) Print
Expand All

WeakReference.Target Property

Gets or sets the object (the target) referenced by this instance.

[Visual Basic]
Public Overridable Property Target As Object
[C#]
public virtual object Target {get; set;}
[C++]
public: __property virtual Object* get_Target();
public: __property virtual void set_Target(Object*);
[JScript]
public function get Target() : Object;
public function set Target(Object);

Property Value

A null reference (Nothing in Visual Basic) if the object referenced by this instance has been garbage collected; otherwise, a reference to the object referenced by this instance.

Exceptions

Exception Type Condition
InvalidOperationException The reference to the target object is invalid.

Remarks

An exception is thrown if the reference to the object referenced by this instance is invalid. This can occur if there is an attempt to resurrect the referenced object after it has been finalized.

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

See Also

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

Show:
© 2014 Microsoft