public void Add(
string key,
TValue value
)
Public Sub Add (
key As String,
value As TValue
)
public:
virtual void Add(
String^ key,
TValue value
) sealed
abstract Add :
key : string *
value : 'TValue -> unit
override Add :
key : string *
value : 'TValue -> unit
A key cannot be , but a value can be, if the type of values in the sorted list, TValue, is a reference or NullableT type.
You can also use the indexer to add new elements by setting the value of a key that does not exist in the StringKeyedDictionaryTValue. for example:
myCollection["myNonexistentKey"] = myValue;
This method approaches an O(1) operation unless if insertion causes a resize, in which case the operation is O(n).
ArgumentNullException | key is . |
ArgumentException | An element with the same key already exists in the StringKeyedDictionaryTValue. |