public TValue this[
TKey key
] { get; set; }
Public Default Property Item (
key As TKey
) As TValue
Get
Set
public:
virtual property TValue default[TKey key] {
TValue get (TKey key) sealed;
void set (TKey key, TValue value) sealed;
}
abstract Item : 'TValue with get, set
override Item : 'TValue with get, set
In this dictionary both the key and the value can be .
If the key is not found when a value is being retrieved, KeyNotFoundException is thrown. If the key is not found when a value is being set, the key and value are added.
You can also use this property to add new elements by setting the value of a key that does not exist in the AllowNullDictionaryTKey, TValue, for example:
myDictionary[myNonexistentKey] = myValue;
Getting or setting this property approaches an O(1) operation.
KeyNotFoundException | The property is retrieved and key is not found. |