Freigeben über


ModelStateDictionary.Add Method (String, ModelState)

Adds an element that has the specified key and value to the model-state dictionary.

Namespace:  System.Web.Mvc
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)

Syntax

'Declaration
Public Sub Add ( _
    key As String, _
    value As ModelState _
)
public void Add(
    string key,
    ModelState value
)
public:
virtual void Add(
    String^ key, 
    ModelState^ value
) sealed

Parameters

Implements

IDictionary<TKey, TValue>.Add(TKey, TValue)

Exceptions

Exception Condition
NotSupportedException

The model-state dictionary is read-only.

ArgumentNullException

key is null reference (Nothing in Visual Basic).

ArgumentException

An element that has the specified key already occurs in the model-state dictionary.

See Also

Reference

ModelStateDictionary Class

Add Overload

System.Web.Mvc Namespace