Share via


Target Property

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Gets or sets the object (the target) referenced by the current WeakReference object.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Overridable Property Target As Object
public virtual Object Target { get; set; }
public:
virtual property Object^ Target {
    Object^ get ();
    void set (Object^ value);
}
abstract Target : Object with get, set
override Target : Object with get, set
function get Target () : Object
function set Target (value : Object)

Property Value

Type: System. . :: . .Object
null Nothing nullptr unit a null reference (Nothing in Visual Basic) if the object referenced by the current WeakReference object has been garbage collected; otherwise, a reference to the object referenced by the current WeakReference object.

Remarks

After setting this property to the target object, make sure that there are no other strong references to the object; otherwise, it will not be collected.

.NET Framework Security

See Also

Reference

WeakReference Class

System Namespace