Share via


WeakReference Constructor (Object, Boolean)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

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

Syntax

'Declaration
<SecuritySafeCriticalAttribute> _
Public Sub New ( _
    target As Object, _
    trackResurrection As Boolean _
)
[SecuritySafeCriticalAttribute]
public WeakReference(
    Object target,
    bool trackResurrection
)

Parameters

  • trackResurrection
    Type: System.Boolean
    Indicates when to stop tracking the object. If true, the object is tracked after finalization; if false, the object is only tracked until finalization.

Remarks

If trackResurrection is false, a short weak reference is created. If trackResurrection is true, a long weak reference is created.

Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows CE Platform Note: Short weak references are supported on the .NET Compact Framework, but long weak references are not supported. When you use this method, you must set the trackResurrection parameter to false.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.