ModelStateDictionary ModelStateDictionary ModelStateDictionary ModelStateDictionary Class

定義

表示模型繫結的狀態。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))
繼承
ModelStateDictionaryModelStateDictionaryModelStateDictionaryModelStateDictionary
屬性
實作

建構函式

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

初始化 ModelStateDictionary 類別的新執行個體。Initializes a new instance of the ModelStateDictionary class.

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

使用現有字典集合,初始化 ModelStateDictionary 類別的新執行個體。Initializes a new instance of the ModelStateDictionary class using an existing dictionary collection.

屬性

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.

方法

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()

取得目前執行個體的 TypeGets the Type of the current instance.

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

判斷是否有任何 ModelError 物件與指定的索引鍵相關聯或是以指定的索引鍵做為前置字元。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()

建立目前 Object 的淺層複本 (Shallow Copy)。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.

明確介面實作

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

傳回列舉值,可用來逐一查看集合。Returns an enumerator that can be used to iterate through the collection.

擴充方法

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

根據輸入 DataTable 物件 (其中泛型參數 TDataRow) 傳回包含 IEnumerable<T> 物件複本的 DataRowReturns 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)

根據輸入 DataRow 物件 (其中泛型參數 TDataTable),將 IEnumerable<T> 物件複製到指定的 DataRowCopies 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)

根據輸入 DataRow 物件 (其中泛型參數 TDataTable),將 IEnumerable<T> 物件複製到指定的 DataRowCopies 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)

IEnumerable 的項目轉換成指定的型別。Casts the elements of an IEnumerable to the specified type.

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

根據指定的型別來篩選 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)

IEnumerable 轉換成 IQueryableConverts 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. 集合中只會包含具有相符之 XName 的項目。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. 集合中只會包含具有相符之 XName 的項目。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. 集合中只會包含具有相符之 XName 的項目。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.

適用於