Export (0) Print
Expand All

ModelStateDictionary Class

Represents the state of an attempt to bind a posted form to an action method, which includes validation information.

System.Object
  System.Web.Mvc.ModelStateDictionary

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

'Declaration
<SerializableAttribute> _
Public Class ModelStateDictionary _
	Implements IDictionary(Of String, ModelState),  _
	ICollection(Of KeyValuePair(Of String, ModelState)), IEnumerable(Of KeyValuePair(Of String, ModelState)),  _
	IEnumerable
'Usage
Dim instance As ModelStateDictionary

The ModelStateDictionary type exposes the following members.

  NameDescription
Public methodModelStateDictionaryInitializes a new instance of the ModelStateDictionary class.
Public methodModelStateDictionary(ModelStateDictionary)Initializes a new instance of the ModelStateDictionary class by using values that are copied from the specified model-state dictionary.
Top

  NameDescription
Public propertyCountGets the number of key/value pairs in the collection.
Public propertyIsReadOnlyGets a value that indicates whether the collection is read-only.
Public propertyIsValidGets a value that indicates whether this instance of the model-state dictionary is valid.
Public propertyItemGets or sets the value that is associated with the specified key.
Public propertyKeysGets a collection that contains the keys in the dictionary.
Public propertyValuesGets a collection that contains the values in the dictionary.
Top

  NameDescription
Public methodAdd(KeyValuePair(Of String, ModelState))Adds the specified item to the model-state dictionary.
Public methodAdd(String, ModelState)Adds an element that has the specified key and value to the model-state dictionary.
Public methodAddModelError(String, Exception)Adds the specified model error to the errors collection for the model-state dictionary that is associated with the specified key.
Public methodAddModelError(String, String)Adds the specified error message to the errors collection for the model-state dictionary that is associated with the specified key.
Public methodClearRemoves all items from the model-state dictionary.
Public methodContainsDetermines whether the model-state dictionary contains a specific value.
Public methodContainsKeyDetermines whether the model-state dictionary contains the specified key.
Public methodCopyToCopies the elements of the model-state dictionary to an array, starting at a specified index.
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetEnumeratorReturns an enumerator that can be used to iterate through the collection.
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Public methodIsValidFieldDetermines whether there are any ModelError objects that are associated with or prefixed with the specified key.
Protected methodMemberwiseClone (Inherited from Object.)
Public methodMergeCopies the values from the specified ModelStateDictionary object into this dictionary, overwriting existing values if keys are the same.
Public methodRemove(KeyValuePair(Of String, ModelState))Removes the first occurrence of the specified object from the model-state dictionary.
Public methodRemove(String)Removes the element that has the specified key from the model-state dictionary.
Public methodSetModelValueSets the value for the specified key by using the specified value provider dictionary.
Public methodToString (Inherited from Object.)
Public methodTryGetValueAttempts to gets the value that is associated with the specified key.
Top

  NameDescription
Explicit interface implemetationPrivate methodIEnumerable.GetEnumeratorReturns an enumerator that can be used to iterate through the collection.
Top

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft