ModelStateDictionary 類別

定義

表示將已張貼的表單繫結至動作方法的結果,其中包括驗證狀態和驗證錯誤訊息等資訊。

public class ModelStateDictionary : System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<string,System.Web.WebPages.Html.ModelState>>, System.Collections.Generic.IDictionary<string,System.Web.WebPages.Html.ModelState>, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,System.Web.WebPages.Html.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))
繼承
ModelStateDictionary
實作

建構函式

ModelStateDictionary()

初始化 ModelStateDictionary 類別的新執行個體。

ModelStateDictionary(ModelStateDictionary)

使用從指定的模型狀態字典複製的值,初始化 類別的新實例 ModelStateDictionary

屬性

Count

取得模型狀態字典包含的模型狀態數量。

IsReadOnly

取得值,這個值表示模型狀態字典是否為唯讀。

IsValid

取得值,這個值表示是否有任何錯誤訊息與模型狀態字典中的任何模型狀態相關聯。

Item[String]

取得或設定模型狀態,這個模型狀態會與模型狀態字典中指定的索引鍵相關聯。

Keys

取得包含模型狀態字典中索引鍵的清單。

Values

取得包含模型狀態字典中值的清單。

方法

Add(KeyValuePair<String,ModelState>)

將指定的項目加入至模型狀態字典。

Add(String, ModelState)

將具有指定索引鍵和值的項目加入至模型狀態字典。

AddError(String, String)

將錯誤訊息加入至與指定之索引鍵相關聯的模型狀態。

AddFormError(String)

將錯誤訊息加入至與整個表單相關聯的模型狀態。

Clear()

從模型狀態字典移除所有項目。

Contains(KeyValuePair<String,ModelState>)

判斷模型狀態字典是否包含指定的項目。

ContainsKey(String)

判斷模型狀態字典是否包含指定的索引鍵。

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

從指定的索引開始,將模型狀態字典的項目複製到陣列。

GetEnumerator()

傳回列舉值,可用來逐一查看集合。

IsValidField(String)

判斷是否有任何錯誤訊息與指定的索引鍵相關聯。

Merge(ModelStateDictionary)

將指定模型狀態字典中的值複製到這個 ModelStateDictionary 實例,在索引鍵相同時覆寫現有的值。

Remove(KeyValuePair<String,ModelState>)

從模型狀態字典中移除第一次出現的指定的項目。

Remove(String)

從模型狀態字典移除具有指定之索引鍵的項目。

SetModelValue(String, Object)

設定與指定之索引鍵相關聯的模型狀態值。

TryGetValue(String, ModelState)

取得與指定之索引鍵相關聯的模型狀態值。

明確介面實作

IEnumerable.GetEnumerator()

傳回可用來逐一查看模型狀態字典的列舉程式。

適用於