Пример #1
0
 private static bool?GetBoolean(object obj)
 {
     if (obj is string str && StringBooleanDeterminer.Is(str))
     {
         return(StringBooleanDeterminer.To(str));
     }
     return(GlobalBooleanVerbaManager.Determining(obj.ToString()?.Trim().ToLower()));
 }
        protected override bool IsValidImpl(object value)
        {
            if (VerifiableMember.MemberType == TypeClass.BooleanClazz || VerifiableMember.MemberType == TypeClass.BooleanNullableClazz)
            {
                return(true);
            }

            if (value is bool)
            {
                return(true);
            }

            if (value is string strValue)
            {
                return(StringBooleanDeterminer.Is(strValue));
            }

            return(StringBooleanDeterminer.Is(value.ToString()));
        }
Пример #3
0
 public static bool __booleanIs(string s, Type type, Action <object> action) =>
 type == TypeClass.BooleanClazz && StringBooleanDeterminer.Is(s, ValueConverter.ConvertAct <bool>(action));
Пример #4
0
 /// <summary>
 /// Is boolean
 /// </summary>
 /// <param name="str"></param>
 /// <returns></returns>
 public static bool IsBoolean(this string str) => StringBooleanDeterminer.Is(str);