ModelStateDictionary ModelStateDictionary ModelStateDictionary ModelStateDictionary Class

Definition

Represents the state of model binding.

public ref class ModelStateDictionary : System::Collections::Generic::ICollection<System::Collections::Generic::KeyValuePair<System::String ^, System::Web::ModelBinding::ModelState ^>>, System::Collections::Generic::IDictionary<System::String ^, System::Web::ModelBinding::ModelState ^>, System::Collections::Generic::IEnumerable<System::Collections::Generic::KeyValuePair<System::String ^, System::Web::ModelBinding::ModelState ^>>
[System.Serializable]
public class ModelStateDictionary : System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<string,System.Web.ModelBinding.ModelState>>, System.Collections.Generic.IDictionary<string,System.Web.ModelBinding.ModelState>, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,System.Web.ModelBinding.ModelState>>
type ModelStateDictionary = class
    interface IDictionary<string, ModelState>
    interface ICollection<KeyValuePair<string, ModelState>>
    interface seq<KeyValuePair<string, ModelState>>
    interface IEnumerable
Public Class ModelStateDictionary
Implements ICollection(Of KeyValuePair(Of String, ModelState)), IDictionary(Of String, ModelState), IEnumerable(Of KeyValuePair(Of String, ModelState))
Inheritance
ModelStateDictionaryModelStateDictionaryModelStateDictionaryModelStateDictionary
Attributes
Implements

Constructors

ModelStateDictionary() ModelStateDictionary() ModelStateDictionary() ModelStateDictionary()

Initializes a new instance of the ModelStateDictionary class.

ModelStateDictionary(ModelStateDictionary) ModelStateDictionary(ModelStateDictionary) ModelStateDictionary(ModelStateDictionary) ModelStateDictionary(ModelStateDictionary)

Initializes a new instance of the ModelStateDictionary class using an existing dictionary collection.

Properties

Count Count Count Count

Gets the number of key/value pairs in the collection.

IsReadOnly IsReadOnly IsReadOnly IsReadOnly

Gets a value that indicates whether the dictionary is read-only.

IsValid IsValid IsValid IsValid

Gets a value that indicates whether there are any errors in any of the model state objects in the dictionary.

Item[String] Item[String] Item[String] Item[String]

Gets or sets the value that is associated with the specified key.

Keys Keys Keys Keys

Gets a collection that contains the keys of the dictionary.

Values Values Values Values

Gets a collection that contains the values of the dictionary.

Methods

Add(KeyValuePair<String,ModelState>) Add(KeyValuePair<String,ModelState>) Add(KeyValuePair<String,ModelState>) Add(KeyValuePair<String,ModelState>)

Adds the specified item to the dictionary.

Add(String, ModelState) Add(String, ModelState) Add(String, ModelState) Add(String, ModelState)

Adds an item that has the specified key and value to the dictionary.

AddModelError(String, Exception) AddModelError(String, Exception) AddModelError(String, Exception) AddModelError(String, Exception)

Adds a model error to the errors collection using the specified key and using the specified exception for the value.

AddModelError(String, String) AddModelError(String, String) AddModelError(String, String) AddModelError(String, String)

Adds the specified model error to the errors collection using the specified key and using the specified error message string for the value.

Clear() Clear() Clear() Clear()

Removes all items from the dictionary.

Contains(KeyValuePair<String,ModelState>) Contains(KeyValuePair<String,ModelState>) Contains(KeyValuePair<String,ModelState>) Contains(KeyValuePair<String,ModelState>)

Determines whether the model-state dictionary contains a specific item.

ContainsKey(String) ContainsKey(String) ContainsKey(String) ContainsKey(String)

Determines whether the model-state dictionary contains the specified key.

CopyTo(KeyValuePair<String,ModelState>[], Int32) CopyTo(KeyValuePair<String,ModelState>[], Int32) CopyTo(KeyValuePair<String,ModelState>[], Int32) CopyTo(KeyValuePair<String,ModelState>[], Int32)

Copies the elements of the dictionary to an array, starting at a specified index.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

Returns an enumerator that can be used to iterate through the dictionary.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
IsValidField(String) IsValidField(String) IsValidField(String) IsValidField(String)

Determines whether there are any ModelError objects that are associated with the specified key or that are prefixed with the specified key.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
Merge(ModelStateDictionary) Merge(ModelStateDictionary) Merge(ModelStateDictionary) Merge(ModelStateDictionary)

Copies the values from the specified model-state dictionary object into this dictionary, overwriting existing values if the keys are the same.

Remove(KeyValuePair<String,ModelState>) Remove(KeyValuePair<String,ModelState>) Remove(KeyValuePair<String,ModelState>) Remove(KeyValuePair<String,ModelState>)

Removes the first occurrence of the specified item from the model-state dictionary.

Remove(String) Remove(String) Remove(String) Remove(String)

Removes the item that has the specified key from the dictionary.

SetModelValue(String, ValueProviderResult) SetModelValue(String, ValueProviderResult) SetModelValue(String, ValueProviderResult) SetModelValue(String, ValueProviderResult)

Sets the value for the specified key.

ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)
TryGetValue(String, ModelState) TryGetValue(String, ModelState) TryGetValue(String, ModelState) TryGetValue(String, ModelState)

Attempts to gets the value that is associated with the specified key.

Explicit Interface Implementations

IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator()

Returns an enumerator that can be used to iterate through the collection.

Extension Methods

CopyToDataTable<T>(IEnumerable<T>) CopyToDataTable<T>(IEnumerable<T>) CopyToDataTable<T>(IEnumerable<T>) CopyToDataTable<T>(IEnumerable<T>)

Returns a DataTable that contains copies of the DataRow objects, given an input IEnumerable<T> object where the generic parameter T is DataRow.

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption)

Copies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter T is DataRow.

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler)

Copies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter T is DataRow.

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

Converts an IEnumerable to an IQueryable.

Ancestors<T>(IEnumerable<T>) Ancestors<T>(IEnumerable<T>) Ancestors<T>(IEnumerable<T>) Ancestors<T>(IEnumerable<T>)

Returns a collection of elements that contains the ancestors of every node in the source collection.

Ancestors<T>(IEnumerable<T>, XName) Ancestors<T>(IEnumerable<T>, XName) Ancestors<T>(IEnumerable<T>, XName) Ancestors<T>(IEnumerable<T>, XName)

Returns a filtered collection of elements that contains the ancestors of every node in the source collection. Only elements that have a matching XName are included in the collection.

DescendantNodes<T>(IEnumerable<T>) DescendantNodes<T>(IEnumerable<T>) DescendantNodes<T>(IEnumerable<T>) DescendantNodes<T>(IEnumerable<T>)

Returns a collection of the descendant nodes of every document and element in the source collection.

Descendants<T>(IEnumerable<T>) Descendants<T>(IEnumerable<T>) Descendants<T>(IEnumerable<T>) Descendants<T>(IEnumerable<T>)

Returns a collection of elements that contains the descendant elements of every element and document in the source collection.

Descendants<T>(IEnumerable<T>, XName) Descendants<T>(IEnumerable<T>, XName) Descendants<T>(IEnumerable<T>, XName) Descendants<T>(IEnumerable<T>, XName)

Returns a filtered collection of elements that contains the descendant elements of every element and document in the source collection. Only elements that have a matching XName are included in the collection.

Elements<T>(IEnumerable<T>) Elements<T>(IEnumerable<T>) Elements<T>(IEnumerable<T>) Elements<T>(IEnumerable<T>)

Returns a collection of the child elements of every element and document in the source collection.

Elements<T>(IEnumerable<T>, XName) Elements<T>(IEnumerable<T>, XName) Elements<T>(IEnumerable<T>, XName) Elements<T>(IEnumerable<T>, XName)

Returns a filtered collection of the child elements of every element and document in the source collection. Only elements that have a matching XName are included in the collection.

InDocumentOrder<T>(IEnumerable<T>) InDocumentOrder<T>(IEnumerable<T>) InDocumentOrder<T>(IEnumerable<T>) InDocumentOrder<T>(IEnumerable<T>)

Returns a collection of nodes that contains all nodes in the source collection, sorted in document order.

Nodes<T>(IEnumerable<T>) Nodes<T>(IEnumerable<T>) Nodes<T>(IEnumerable<T>) Nodes<T>(IEnumerable<T>)

Returns a collection of the child nodes of every document and element in the source collection.

Remove<T>(IEnumerable<T>) Remove<T>(IEnumerable<T>) Remove<T>(IEnumerable<T>) Remove<T>(IEnumerable<T>)

Removes every node in the source collection from its parent node.

Applies to