Show / Hide Table of Contents

    Class WeakReference

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

    Inheritance
    Object
    WeakReference
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: System
    Assembly: mscorlib.dll
    Syntax
    public class WeakReference

    Constructors

    WeakReference(Object)

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

    Declaration
    public extern WeakReference(object target)
    Parameters
    Type Name Description
    Object target

    The object to track or null.

    Properties

    IsAlive

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

    Declaration
    public virtual bool IsAlive { get; }
    Property Value
    Type Description
    Boolean

    true if the object referenced by the current WeakReference object has not been garbage collected and is still accessible; otherwise, false.

    Target

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

    Declaration
    public virtual object Target { get; set; }
    Property Value
    Type Description
    Object

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

    Extension Methods

    LogDispatcher.GetCurrentClassLogger(Object)
    • Improve this Doc
    • View Source
    Back to top Copyright © 2018 nanoFramework Contributors
    Generated by DocFX