SortedDictionary<TKey, TValue>::ICollection<KeyValuePair<TKey, TValue>>::Add Method (KeyValuePair<TKey, TValue>)

 

Adds an item to the ICollection<T>.

Namespace:   System.Collections.Generic
Assembly:  System (in System.dll)

private:
virtual void Add(
	KeyValuePair<TKey, TValue> keyValuePair
) sealed = ICollection<KeyValuePair<TKey, TValue>>::Add

Parameters

keyValuePair
Type: System.Collections.Generic::KeyValuePair<TKey, TValue>

The KeyValuePair<TKey, TValue> structure to add to the ICollection<T>.

Exception Condition
ArgumentNullException

keyValuePair is null.

ArgumentException

An element with the same key already exists in the SortedDictionary<TKey, TValue>.

A key cannot be null, but a value can be, if the value type TValue is a reference type.

This method is an O(log n) operation, where n is Count.

Universal Windows Platform
Available since 8
.NET Framework
Available since 2.0
Portable Class Library
Supported in: portable .NET platforms
Windows Phone Silverlight
Available since 8.0
Windows Phone
Available since 8.1
Return to top
Show: