Show / Hide Table of Contents

    Class WeakKey<T>

    Wrapping a weak reference and recording hash code. Note: It is the responsibility of the client to clean up the collection entry in the finalizer of the object. Otherwise the key will not match for subsequent lookups.

    Inheritance
    Object
    WeakKey<T>
    Inherited Members
    Object.ToString()
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Microsoft.Graph.Communications.Common
    Assembly: Microsoft.Graph.Communications.Common.dll
    Syntax
    public class WeakKey<T>
    
        where T : class
    Type Parameters
    Name Description
    T

    Type of the key to be used in a lookup.

    Constructors

    WeakKey(T)

    Initializes a new instance of the WeakKey<T> class.

    Declaration
    public WeakKey(T t)
    Parameters
    Type Name Description
    T t

    Underlying object.

    WeakKey(WeakReference<T>)

    Initializes a new instance of the WeakKey<T> class.

    Declaration
    public WeakKey(WeakReference<T> weak)
    Parameters
    Type Name Description
    WeakReference<T> weak

    Underlying object wrapped in weak reference.

    Properties

    Unwrapped

    Gets the target.

    Declaration
    public T Unwrapped { get; }
    Property Value
    Type Description
    T

    Value

    Gets the weak reference to the underlying object.

    Declaration
    public WeakReference<T> Value { get; }
    Property Value
    Type Description
    WeakReference<T>

    Methods

    Equals(Object)

    Determines whether the specified object is equal to the current object.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    Object obj

    The object to compare with the current object.

    Returns
    Type Description
    Boolean

    true if the specified object is equal to the current object.

    Overrides
    Object.Equals(Object)

    GetHashCode()

    Overrides hash code to hand out the underlying object's hash code.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    Int32

    Hash code of underlying object.

    Overrides
    Object.GetHashCode()

    Operators

    Implicit(T to WeakKey<T>)

    Implicit cast operator to weak key.

    Declaration
    public static implicit operator WeakKey<T>(T t)
    Parameters
    Type Name Description
    T t

    Wrap with weak key.

    Returns
    Type Description
    WeakKey<T>

    Implicit(WeakKey<T> to T)

    Implicit type cast operator.

    Declaration
    public static implicit operator T(WeakKey<T> key)
    Parameters
    Type Name Description
    WeakKey<T> key

    Extract underlying object.

    Returns
    Type Description
    T

    Extension Methods

    AdditionalDataExtensions.SetInAdditionalData(Object, String, Object)
    Extensions.Pin(Object)
    Extensions.ChangeType(Object, Type)
    Extensions.ChangeType<T>(Object)
    Extensions.TryDispose(Object, IGraphLogger)
    ReflectionUtils.GetPropertyUsingReflection(Object, String)
    ReflectionUtils.SetPropertyUsingReflection(Object, String, Object)
    Validator.IsNull(Object, String, String)
    Validator.NotNull<T>(T, String, String)
    Validator.Equals<T>(T, T, String, String)
    Validator.Equals<T, TE>(T, T, String)
    Validator.NotEquals<T>(T, T, String, String)
    Back to top Copyright (c) Microsoft Corporation. All rights reserved.