Example #1
0
 /// <summary>
 /// 验证指定的key是否有错误
 /// </summary>
 /// <param name="key"></param>
 /// <returns></returns>
 public bool IsValidField(string key)
 {
     if (key == null)
     {
         throw new ArgumentNullException("key");
     }
     return(DictionaryHelpers.FindKeysWithPrefix <ModelState>(this, key).All(
                (KeyValuePair <string, ModelState> entry) => entry.Value.Errors.Count == 0));
 }
Example #2
0
 /// <summary>
 /// 是否含有指定前缀的key
 /// </summary>
 /// <typeparam name="TValue"></typeparam>
 /// <param name="dictionary"></param>
 /// <param name="prefix"></param>
 /// <returns></returns>
 public static bool DoesAnyKeyHavePrefix <TValue>(IDictionary <string, TValue> dictionary, string prefix)
 {
     return(DictionaryHelpers.FindKeysWithPrefix <TValue>(dictionary, prefix).Any());
 }