public DType Accept(TInt type, string x) { if (int.TryParse(x, out var b)) { return(DInt.ValueOf(b)); } else { throw new Exception($"{x} 不是int类型"); } }
public DType Accept(TInt type, ExcelStream x) { var d = x.Read(); if (CheckNull(type.IsNullable, d)) { return(null); } var ds = d.ToString(); //if (field?.Remapper is TEnum te) //{ // if (te.DefineEnum.TryValueByNameOrAlias(ds, out var c)) // { // return DInt.ValueOf(c); // } //} if (!int.TryParse(ds, out var v)) { throw new InvalidExcelDataException($"{d} 不是 int 类型值"); } return(DInt.ValueOf(v)); }
public DType Accept(TInt type, XElement x, DefAssembly ass) { return(DInt.ValueOf(int.Parse(x.Value.Trim()))); }
public DType Accept(TInt type, object x, DefAssembly ass) { return(DInt.ValueOf((int)x)); }
public DType Accept(TInt type, JsonElement x, DefAssembly ass) { return(DInt.ValueOf(x.GetInt32())); }