Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​WeakReference
Assembly: System.Runtime
Inheritance: object → WeakReference
Implemented Interfaces
Represents a weak reference, which references an object while still allowing that object to be reclaimed by garbage collection.
Properties
public
bool
IsAlive
Gets an indication whether the object referenced by the current <see cref="T:System.WeakReference" /> object has been garbage collected.
public
object
Target
Gets or sets the object (the target) referenced by the current <see cref="T:System.WeakReference" /> object.
public
bool
TrackResurrection
Gets an indication whether the object referenced by the current <see cref="T:System.WeakReference" /> object is tracked after it is finalized.
Methods
protected
void
Finalize​()
Discards the reference to the target represented by the current <see cref="T:System.WeakReference" /> object.
public
void
GetObjectData​(SerializationInfo info,
StreamingContext context)
Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object with all the data needed to serialize the current <see cref="T:System.WeakReference" /> object.
info
An object that holds all the data needed to serialize or deserialize the current <see cref="T:System.WeakReference" /> object.
context
(Reserved) The location where serialized data is stored and retrieved.
public
bool
Equals​(object obj)
Inherited from object
Determines whether the specified object is equal to the current object.
Returns <see langword="true" /> if the specified object is equal to the current object; otherwise, <see langword="false" /> .
obj
The object to compare with the current object.
public
int
GetHashCode​()
Inherited from object
Serves as the default hash function.
Returns A hash code for the current object.
public
Type
GetType​()
Inherited from object
Gets the <see cref="T:System.Type" /> of the current instance.
Returns The exact runtime type of the current instance.
protected
object
MemberwiseClone​()
Inherited from object
Creates a shallow copy of the current <see cref="T:System.Object" /> .
Returns A shallow copy of the current <see cref="T:System.Object" /> .
public
string
ToString​()
Inherited from object
Returns a string that represents the current object.
Returns A string that represents the current object.