Share via


ModelStateDictionary.Remove 方法

定義

多載

Remove(KeyValuePair<String,ModelState>)

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

Remove(String)

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

Remove(KeyValuePair<String,ModelState>)

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

public bool Remove (System.Collections.Generic.KeyValuePair<string,System.Web.Mvc.ModelState> item);
abstract member Remove : System.Collections.Generic.KeyValuePair<string, System.Web.Mvc.ModelState> -> bool
override this.Remove : System.Collections.Generic.KeyValuePair<string, System.Web.Mvc.ModelState> -> bool
Public Function Remove (item As KeyValuePair(Of String, ModelState)) As Boolean

參數

item
KeyValuePair<String,ModelState>

要從模型狀態字典移除的物件。

傳回

如果 item 已成功移除模型狀態字典,則為 true,否則為 false。 如果在 item 模型狀態字典中找不到 ,這個方法也會傳回 false。

實作

例外狀況

模型狀態字典為唯讀。

適用於

Remove(String)

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

public bool Remove (string key);
abstract member Remove : string -> bool
override this.Remove : string -> bool
Public Function Remove (key As String) As Boolean

參數

key
String

要移除的項目索引鍵。

傳回

如果成功移除項目則為 true,否則為 false。 如果在 key 模型狀態字典中找不到 ,這個方法也會傳回 false。

實作

例外狀況

模型狀態字典為唯讀。

key 為 null。

適用於