< T > Class
.NET Framework 4.6 and 4.5
Represents a typed weak reference, which references an object while still allowing that object to be reclaimed by garbage collection.
generic< typename T>
where T : ref class
public ref class WeakReference sealed : ISerializable
Type Parameters T
The type of the object referenced.
WeakReference type exposes the following members. <T >
Name Description WeakReference <T >(T) Initializes a new instance of the class that references the specified object. WeakReference <T > WeakReference <T >(T, Boolean) Initializes a new instance of the class that references the specified object and uses the specified resurrection tracking. WeakReference <T > Top
Name Description Equals(Object) Determines whether the specified object is equal to the current object. (Inherited from Object.) Finalize Discards the reference to the target that is represented by the current (Overrides object. WeakReference <T > Object.) ::Finalize () GetHashCode Serves as the default hash function. (Inherited from Object.) GetObjectData Populates a object with all the data necessary to serialize the current SerializationInfo object. WeakReference <T > GetType Gets the (Inherited from of the current instance. Type Object.) SetTarget Sets the target object that is referenced by this object. WeakReference <T > ToString Returns a string that represents the current object. (Inherited from Object.) TryGetTarget Tries to retrieve the target object that is referenced by the current object. WeakReference <T > Top
A weak reference enables the garbage collector to collect an object while still allowing an application to access the object. If you need the object, you can obtain a strong reference to it and prevent it from being collected.
Supported in: 4.6, 4.5
.NET for Windows Phone apps
Supported in: Windows Phone 8.1, Windows Phone Silverlight 8.1, Windows Phone Silverlight 8
in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.