public static sbyte ObjectToSByte(object obj, sbyte defaultVal = default) { return(obj switch { null => defaultVal, sbyte myself => myself, string str => StringToSByte(str, defaultVal), _ => XConvHelper.D(obj.ToString(), StringSByteDeterminer.IS, defaultVal, StringToSByte, out var val) ? val : XConvHelper.T(() => Convert.ToSByte(ObjectToDecimal(obj, defaultVal)), defaultVal) });
public static DateTime ObjectToDateTime(object obj, DateTime defaultVal = default) { return(obj switch { null => defaultVal, string str => StringToDateTime(str, defaultVal), DateTime d => d, _ => XConvHelper.D(obj.ToString(), StringDateTimeDeterminer.IS, defaultVal, StringToDateTime, out var val) ? val : XConvHelper.T(() => Convert.ToDateTime(obj), defaultVal) });