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.
Inherited Members
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 |
|
Overrides
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
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 |