ViewDataDictionary::Add Method
Adds an item to the collection.
Assembly: System.Web.Mvc (in System.Web.Mvc.dll)
| Name | Description | |
|---|---|---|
![]() | Add(KeyValuePair<String^, Object^>) | Adds the specified item to the collection. |
![]() | Add(String^, Object^) | Adds an element to the collection using the specified key and value . |
ViewDataDictionary::Add Method (KeyValuePair<String^, Object^>)
Adds the specified item to the collection.
Parameters
- item
-
Type:
System.Collections.Generic::KeyValuePair<String^, Object^>
The object to add to the collection.
Implements
ICollection<T>::Add(T)| Exception | Condition |
|---|---|
| NotSupportedException | The collection is read-only. |
ViewDataDictionary::Add Method (String^, Object^)
Adds an element to the collection using the specified key and value .
Parameters
- key
-
Type:
System::String^
The key of the element to add.
- value
-
Type:
System::Object^
The value of the element to add.
| Exception | Condition |
|---|---|
| NotSupportedException | The IDictionary<TKey, TValue> object is read-only. |
| ArgumentNullException | key is null. |
| ArgumentException | An element with the same key already exists in the IDictionary<TKey, TValue> object. |
Show:
