ModelStateDictionary Class
Represents the result of binding a posted form to an action method, which includes information such as validation status and validation error messages.
Inheritance Hierarchy
System.Object
System.Web.WebPages.Html.ModelStateDictionary
Namespace: System.Web.WebPages.Html
Assembly: System.Web.WebPages (in System.Web.WebPages.dll)
Syntax
'Declaration
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
public class ModelStateDictionary : IDictionary<string, ModelState>,
ICollection<KeyValuePair<string, ModelState>>, IEnumerable<KeyValuePair<string, ModelState>>,
IEnumerable
public ref class ModelStateDictionary : IDictionary<String^, ModelState^>,
ICollection<KeyValuePair<String^, ModelState^>>, IEnumerable<KeyValuePair<String^, ModelState^>>,
IEnumerable
type ModelStateDictionary =
class
interface IDictionary<string, ModelState>
interface ICollection<KeyValuePair<string, ModelState>>
interface IEnumerable<KeyValuePair<string, ModelState>>
interface IEnumerable
end
public class ModelStateDictionary implements IDictionary<String, ModelState>, ICollection<KeyValuePair<String, ModelState>>, IEnumerable<KeyValuePair<String, ModelState>>, IEnumerable
The ModelStateDictionary type exposes the following members.
Constructors
Name | Description | |
---|---|---|
ModelStateDictionary() | Initializes a new instance of the ModelStateDictionary class. | |
ModelStateDictionary(ModelStateDictionary) | Initializes a new instance of the ModelStateDictionary class by using values that are copied from the specified model-state dictionary. |
Top
Properties
Name | Description | |
---|---|---|
Count | Gets the number of model states that the model-state dictionary contains. | |
IsReadOnly | Gets a value that indicates whether the model-state dictionary is read-only. | |
IsValid | Gets a value that indicates whether any error messages are associated with any model state in the model-state dictionary. | |
Item | Gets or sets the model state that is associated with the specified key in the model-state dictionary. | |
Keys | Gets a list that contains the keys in the model-state dictionary. | |
Values | Gets a list that contains the values in the model-state dictionary. |
Top
Methods
Name | Description | |
---|---|---|
Add(KeyValuePair<String, ModelState>) | Adds the specified item to the model-state dictionary. | |
Add(String, ModelState) | Adds an item that has the specified key and value to the model-state dictionary. | |
AddError | Adds an error message to the model state that is associated with the specified key. | |
AddFormError | Adds an error message to the model state that is associated with the entire form. | |
Clear | Removes all items from the model-state dictionary. | |
Contains | Determines whether the model-state dictionary contains the specified item. | |
ContainsKey | Determines whether the model-state dictionary contains the specified key. | |
CopyTo | Copies the elements of the model-state dictionary to an array, starting at the specified index. | |
Equals | (Inherited from Object.) | |
Finalize | (Inherited from Object.) | |
GetEnumerator | Returns an enumerator that can be used to iterate through the collection. | |
GetHashCode | (Inherited from Object.) | |
GetType | (Inherited from Object.) | |
IsValidField | Determines whether any error messages are associated with the specified key. | |
MemberwiseClone | (Inherited from Object.) | |
Merge | Copies the values from the specified model-state dictionary into this ModelStateDictionary instance, overwriting existing values when the keys are the same. | |
Remove(KeyValuePair<String, ModelState>) | Removes the first occurrence of the specified item from the model-state dictionary. | |
Remove(String) | Removes the item that has the specified key from the model-state dictionary. | |
SetModelValue | Sets the value of the model state that is associated with the specified key. | |
ToString | (Inherited from Object.) | |
TryGetValue | Gets the model-state value that is associated with the specified key. |
Top
Explicit Interface Implementations
Name | Description | |
---|---|---|
IEnumerable.GetEnumerator | Returns an enumerator that can be used to iterate through the model-state dictionary. |
Top
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.