class WeakReference

in global :: System

Represents a weak reference, which references an object while still allowing that object to be reclaimed by garbage collection.


public WeakReference( object target )

Initializes a new instance of the class, referencing the specified object.

  • target The object to track or .

public WeakReference( object target, bool trackResurrection )

Initializes a new instance of the class, referencing the specified object and using the specified resurrection tracking.

  • target An object to track.
  • trackResurrection Indicates when to stop tracking the object. If , the object is tracked after finalization; if , the object is only tracked until finalization.

public void GetObjectData( SerializationInfo info, StreamingContext context )

Populates a object with all the data needed to serialize the current object.

  • info An object that holds all the data needed to serialize or deserialize the current object.
  • context (Reserved) The location where serialized data is stored and retrieved.

public bool IsAlive { get; }

Gets an indication whether the object referenced by the current object has been garbage collected.

  • Returns if the object referenced by the current object has not been garbage collected and is still accessible; otherwise, .

public object Target { get; set; }

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

  • Returns if the object referenced by the current object has been garbage collected; otherwise, a reference to the object referenced by the current object.

public bool TrackResurrection { get; }

Gets an indication whether the object referenced by the current object is tracked after it is finalized.

  • Returns if the object the current object refers to is tracked after finalization; or if the object is only tracked until finalization.

public Type GetType( )

😔 No documentation found.

public string ToString( )

😔 No documentation found.

public bool Equals( object obj )

😔 No documentation found.

public int GetHashCode( )

😔 No documentation found.