Class
WeakReferenceDictionary<TKey, TValue>

Represents a dictionary that holds WeakReferences to its values.

Definition

Namespace:Telerik.Windows.Diagrams.Core

Assembly:Telerik.Windows.Diagrams.Core.dll

Type Parameters:

TKey

TValue

Syntax:

cs-api-definition
public class WeakReferenceDictionary<TKey, TValue> : IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable

Inheritance: objectWeakReferenceDictionary<TKey, TValue>

Implements: ICollection<KeyValuePair<TKey, TValue>>IDictionary<TKey, TValue>IEnumerableIEnumerable<KeyValuePair<TKey, TValue>>

Constructors

WeakReferenceDictionary()

Initializes a new instance of the WeakReferenceDictionary class.

Declaration

cs-api-definition
public WeakReferenceDictionary()

Properties

Count

Gets the number of elements contained in the dictionary.

Declaration

cs-api-definition
public int Count { get; }

Property Value

int

Implements ICollection<KeyValuePair<TKey, TValue>>.Count

IsReadOnly

Gets a value indicating whether the dictionary is read-only.

Declaration

cs-api-definition
public bool IsReadOnly { get; }

Property Value

bool

Implements ICollection<KeyValuePair<TKey, TValue>>.IsReadOnly

Keys

Gets an ICollection containing the keys of the dictionary.

Declaration

cs-api-definition
public ICollection<TKey> Keys { get; }

Property Value

ICollection<TKey>

Implements IDictionary<TKey, TValue>.Keys

Values

Gets an ICollection containing the values in the dictionary.

Declaration

cs-api-definition
public ICollection<TValue> Values { get; }

Property Value

ICollection<TValue>

Implements IDictionary<TKey, TValue>.Values

this[TKey]

Gets or sets the value associated with the specified key.

Declaration

cs-api-definition
public TValue this[TKey key] { get; set; }

Parameters

key

TKey

Property Value

TValue

Implements IDictionary<TKey, TValue>.this[TKey]

Methods

Add(TKey, TValue)

Adds the specified key and value to the dictionary.

Declaration

cs-api-definition
public void Add(TKey key, TValue value)

Parameters

key

TKey

The key.

value

TValue

The value.

Implements IDictionary<TKey, TValue>.Add(TKey, TValue)

Clear()

Removes all keys and values from the dictionary.

Declaration

cs-api-definition
public void Clear()

Implements ICollection<KeyValuePair<TKey, TValue>>.Clear()

Contains(KeyValuePair<TKey, TValue>)

Determines whether a sequence contains a specified element.

Declaration

cs-api-definition
public bool Contains(KeyValuePair<TKey, TValue> item)

Parameters

item

KeyValuePair<TKey, TValue>

The item.

Returns

bool

Implements ICollection<KeyValuePair<TKey, TValue>>.Contains(KeyValuePair<TKey, TValue>)

ContainsKey(TKey)

Determines whether the dictionary contains the specified key.

Declaration

cs-api-definition
public bool ContainsKey(TKey key)

Parameters

key

TKey

The key.

Returns

bool

Implements IDictionary<TKey, TValue>.ContainsKey(TKey)

CopyTo(KeyValuePair<TKey, TValue>[], int)

Copies the elements of the dictionary to an array, starting at a particular index.

Declaration

cs-api-definition
public void CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)

Parameters

array

KeyValuePair<TKey, TValue>[]

The array.

arrayIndex

int

Index of the array.

Implements ICollection<KeyValuePair<TKey, TValue>>.CopyTo(KeyValuePair<TKey, TValue>[], int)

GetEnumerator()

Returns an enumerator that iterates through the dictionary.

Declaration

cs-api-definition
public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()

Returns

IEnumerator<KeyValuePair<TKey, TValue>>

Implements IEnumerable<KeyValuePair<TKey, TValue>>.GetEnumerator()

Remove(TKey)

Removes the value with the specified key from the dictionary.

Declaration

cs-api-definition
public bool Remove(TKey key)

Parameters

key

TKey

The key.

Returns

bool

Implements IDictionary<TKey, TValue>.Remove(TKey)

TryGetValue(TKey, out TValue)

Gets the value associated with the specified key.

Declaration

cs-api-definition
public bool TryGetValue(TKey key, out TValue value)

Parameters

key

TKey

The key.

value

TValue

The value.

Returns

bool

Implements IDictionary<TKey, TValue>.TryGetValue(TKey, out TValue)