public TValue this[
string key
] { get; set; }
Public Default Property Item (
key As String
) As TValue
Get
Set
public:
virtual property TValue default[String^ key] {
TValue get (String^ key) sealed;
void set (String^ key, TValue value) sealed;
}
abstract Item : 'TValue with get, set
override Item : 'TValue with get, set
A key cannot be , but a value can be, if the type of values in the list, TValue, is a reference or NullableT type.
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 StringKeyedDictionaryTValue, for example:
myDictionary["myNonexistentKey"] = myValue;
Getting or setting this property approaches an O(1) operation.
ArgumentNullException | key is . |
KeyNotFoundException | The property is retrieved and key is not found. |