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

            if (CheckNull(type.IsNullable, d))
            {
                return(null);
            }
            if (!short.TryParse(d.ToString(), out short v))
            {
                throw new InvalidExcelDataException($"{d} 不是 short 类型值");
            }
            return(DShort.ValueOf(v));
        }
Example #3
0
 public DType Accept(TShort type, XElement x, DefAssembly ass)
 {
     return(DShort.ValueOf(short.Parse(x.Value.Trim())));
 }
 public DType Accept(TShort type, object x, DefAssembly ass)
 {
     return(DShort.ValueOf((short)(int)x));
 }
Example #5
0
 public DType Accept(TShort type, JsonElement x, DefAssembly ass)
 {
     return(DShort.ValueOf(x.GetInt16()));
 }