ModelStateDictionary::Add Method
Adds an item to the model-state dictionary.
Assembly: System.Web.Mvc (in System.Web.Mvc.dll)
| Name | Description | |
|---|---|---|
![]() | Add(KeyValuePair<String^, ModelState^>) | Adds the specified item to the model-state dictionary. |
![]() | Add(String^, ModelState^) | Adds an element that has the specified key and value to the model-state dictionary. |
ModelStateDictionary::Add Method (KeyValuePair<String^, ModelState^>)
Adds the specified item to the model-state dictionary.
Parameters
- item
-
Type:
System.Collections.Generic::KeyValuePair<String^, ModelState^>
The object to add to the model-state dictionary.
Implements
ICollection<T>::Add(T)| Exception | Condition |
|---|---|
| NotSupportedException | The model-state dictionary is read-only. |
ModelStateDictionary::Add Method (String^, ModelState^)
Adds an element that has the specified key and value to the model-state dictionary.
Parameters
- key
-
Type:
System::String^
The key of the element to add.
- value
-
Type:
System.Web.Mvc::ModelState^
The value of the element to add.
| Exception | Condition |
|---|---|
| NotSupportedException | The model-state dictionary is read-only. |
| ArgumentNullException | key is null. |
| ArgumentException | An element that has the specified key already occurs in the model-state dictionary. |
Show:
