ModelStateDictionary 類別

定義

表示嘗試將已張貼的表單繫結至動作方法的狀態,包括驗證資訊。

[System.Serializable]
public class ModelStateDictionary : System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<string,System.Web.Mvc.ModelState>>, System.Collections.Generic.IDictionary<string,System.Web.Mvc.ModelState>, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,System.Web.Mvc.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)

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

AddModelError(String, Exception)

針對與指定索引鍵相關聯的模型狀態字典,將指定的模型錯誤加入至該字典的錯誤集合。

AddModelError(String, String)

針對與指定索引鍵相關聯的模型狀態字典,將指定的錯誤訊息加入至該字典的錯誤集合。

Clear()

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

Contains(KeyValuePair<String,ModelState>)

判斷模型狀態字典是否包含特定值。

ContainsKey(String)

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

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

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

GetEnumerator()

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

IsValidField(String)

判斷是否有任何 ModelError 物件與指定的索引鍵相關聯或前置詞。

Merge(ModelStateDictionary)

將指定 ModelStateDictionary 物件的值複製到這個字典,如果索引鍵相同,則會覆寫現有的值。

Remove(KeyValuePair<String,ModelState>)

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

Remove(String)

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

SetModelValue(String, ValueProviderResult)

使用指定的值提供者字典,設定指定之索引鍵的值。

TryGetValue(String, ModelState)

嘗試取得與指定之索引鍵相關聯的值。

明確介面實作

IEnumerable.GetEnumerator()

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

適用於