예제 #1
0
 public DType Accept(TFloat type, string x)
 {
     if (float.TryParse(x, out var b))
     {
         return(DFloat.ValueOf(b));
     }
     else
     {
         throw new Exception($"{x} 不是float类型");
     }
 }
        public DType Accept(TFloat type, ExcelStream x)
        {
            var d = x.Read();

            if (CheckNull(type.IsNullable, d))
            {
                return(null);
            }
            if (!float.TryParse(d.ToString(), out var v))
            {
                throw new InvalidExcelDataException($"{d} 不是 float 类型值");
            }
            return(DFloat.ValueOf(v));
        }
예제 #3
0
 public DType Accept(TFloat type, XElement x, DefAssembly ass)
 {
     return(DFloat.ValueOf(float.Parse(x.Value.Trim())));
 }
예제 #4
0
 public DType Accept(TFloat type, JsonElement x, DefAssembly ass)
 {
     return(DFloat.ValueOf(x.GetSingle()));
 }