ModelStateDictionary.TryGetValue(String, ModelState) 方法

定义

尝试获取与指定的键关联的值。

public bool TryGetValue (string key, out System.Web.Mvc.ModelState value);
abstract member TryGetValue : string * ModelState -> bool
override this.TryGetValue : string * ModelState -> bool
Public Function TryGetValue (key As String, ByRef value As ModelState) As Boolean

参数

key
String

要获取的值的键。

value
ModelState

当此方法返回时,如果找到指定键,则返回与该键相关联的值;否则,将返回 value 参数的类型的默认值。 此参数未经初始化即被传递。

返回

如果实现 IDictionary<TKey,TValue> 的对象包含具有指定键的元素,则为 true;否则为 false。

例外

key 为 null。

适用于