コード例 #1
0
        public static ValueParseResult Parse(object rawValue)
        {
            switch (rawValue)
            {
            case null:
                return(ValueParseResult.CreateFail("Can't be null."));

            case bool _:
                return(ValueParseResult.CreateSuccess(rawValue));

            default:
                return(ValueParseResult.CreateFail("Expected type is: bool."));
            }
        }
コード例 #2
0
 public static ValueParseResult Parse(object rawNumber)
 {
     return(IsNumber(rawNumber)
         ? ValueParseResult.CreateSuccess(rawNumber)
         : ValueParseResult.CreateFail("Expected type is: number (int, double etc)"));
 }