New to Telerik UI for WPFStart a free 30-day trial

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:

C#
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

Initializes a new instance of the WeakReferenceDictionary class.

C#
public WeakReferenceDictionary()

Properties

Gets the number of elements contained in the dictionary.

C#
public int Count { get; }

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

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

C#
public bool IsReadOnly { get; }

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

Gets an ICollection containing the keys of the dictionary.

C#
public ICollection<TKey> Keys { get; }

Implements: IDictionary<TKey, TValue>.Keys

Gets or sets the value associated with the specified key.

C#
public TValue this[TKey key] { get; set; }
Parameters:keyTKey

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

Gets an ICollection containing the values in the dictionary.

C#
public ICollection<TValue> Values { get; }

Implements: IDictionary<TKey, TValue>.Values

Methods

Adds the specified key and value to the dictionary.

C#
public void Add(TKey key, TValue value)
Parameters:keyTKey

The key.

valueTValue

The value.

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

Removes all keys and values from the dictionary.

C#
public void Clear()

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

Determines whether a sequence contains a specified element.

C#
public bool Contains(KeyValuePair<TKey, TValue> item)
Parameters:itemKeyValuePair<TKey, TValue>

The item.

Returns:

bool

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

Determines whether the dictionary contains the specified key.

C#
public bool ContainsKey(TKey key)
Parameters:keyTKey

The key.

Returns:

bool

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

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

C#
public void CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)
Parameters:arrayKeyValuePair<TKey, TValue>[]

The array.

arrayIndexint

Index of the array.

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

Returns an enumerator that iterates through the dictionary.

C#
public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
Returns:

IEnumerator<KeyValuePair<TKey, TValue>>

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

Removes the value with the specified key from the dictionary.

C#
public bool Remove(TKey key)
Parameters:keyTKey

The key.

Returns:

bool

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

Gets the value associated with the specified key.

C#
public bool TryGetValue(TKey key, out TValue value)
Parameters:keyTKey

The key.

valueTValue

The value.

Returns:

bool

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