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`1

Assembly: System.Runtime

Inheritance: object → WeakReference`1

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

Methods

protected void
Finalize​()
Discards the reference to the target that is represented by the current <see cref="T:System.WeakReference`1" /> object.
public void
GetObjectData​(SerializationInfo info, StreamingContext context)
info An object that holds all the data necessary to serialize or deserialize the current <see cref="T:System.WeakReference`1" /> object.
context The location where serialized data is stored and retrieved.
Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object with all the data necessary to serialize the current <see cref="T:System.WeakReference`1" /> object.
public void
SetTarget​(T target)
public bool
TryGetTarget​(T& target)
public bool
Equals​(object obj)
Inherited from object
obj The object to compare with the current object.
Returns <see langword="true" /> if the specified object is equal to the current object; otherwise, <see langword="false" /> .
Determines whether the specified object is equal to the current object.
public int
GetHashCode​()
Inherited from object
Returns A hash code for the current object.
Serves as the default hash function.
public Type
GetType​()
Inherited from object
Returns The exact runtime type of the current instance.
Gets the <see cref="T:System.Type" /> of the current instance.
protected object
MemberwiseClone​()
Inherited from object
Returns A shallow copy of the current <see cref="T:System.Object" /> .
Creates 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.