This documentation is archived and is not being maintained.

WeakReference.Target Property

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

[Visual Basic]
Public Overridable Property Target As Object
public virtual object Target {get; set;}
public: __property virtual Object* get_Target();
public: __property virtual void set_Target(Object*);
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.


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


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.


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