ModelStateDictionary.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.

public:
 bool IsValidField(System::String ^ key);
public bool IsValidField (string key);
member this.IsValidField : string -> bool
Public Function IsValidField (key As String) As Boolean

参数

key
String

键。The key.

返回

Boolean

如果与指定键关联或以指定键为前缀的任何 ModelError 对象,则为 true,否则为 falsetrue if any ModelError objects are associated with the specified key or prefixed with the specified key; otherwise, false. 如果在字典中未找到键,则此方法将返回 trueIf the key is not found in the dictionary, this method returns true.

例外

key 参数为 nullThe key parameter is null.

适用于