Export (0) Print
Expand All
0 out of 3 rated this helpful - Rate this topic

ModelStateDictionary Class

.NET Framework 4

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)
[SerializableAttribute]
public class ModelStateDictionary : IDictionary<string, ModelState>, 
	ICollection<KeyValuePair<string, ModelState>>, IEnumerable<KeyValuePair<string, ModelState>>, 
	IEnumerable

The ModelStateDictionary type exposes the following members.

  NameDescription
Public methodModelStateDictionary()Initializes 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<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 methodEqualsDetermines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetEnumeratorReturns an enumerator that can be used to iterate through the collection.
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodIsValidFieldDetermines whether there are any ModelError objects that are associated with or prefixed with the specified key.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (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<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 methodToStringReturns a string that represents the current object. (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.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.