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.")); } }
public static ValueParseResult Parse(object rawNumber) { return(IsNumber(rawNumber) ? ValueParseResult.CreateSuccess(rawNumber) : ValueParseResult.CreateFail("Expected type is: number (int, double etc)")); }