Partager via


ModelStateDictionary.AddModelError Method (String, Exception)

Adds the specified model error to the errors collection for the model-state dictionary that is associated with the specified key.

Namespace:  System.Web.Http.ModelBinding
Assembly:  System.Web.Http (in System.Web.Http.dll)

Syntax

'Declaration
Public Sub AddModelError ( _
    key As String, _
    exception As Exception _
)
'Usage
Dim instance As ModelStateDictionary
Dim key As String
Dim exception As Exception

instance.AddModelError(key, exception)
public void AddModelError(
    string key,
    Exception exception
)
public:
void AddModelError(
    String^ key, 
    Exception^ exception
)
member AddModelError : 
        key:string * 
        exception:Exception -> unit 
public function AddModelError(
    key : String, 
    exception : Exception
)

Parameters

See Also

Reference

ModelStateDictionary Class

AddModelError Overload

System.Web.Http.ModelBinding Namespace