/// <summary> /// 读取数值的构造方法 /// </summary> /// <param name="temp">读取到的数据</param> public ValueUnit(string temp) { string[] strs = temp.Split('|'); if (strs.Length == 2) { this.Value = long.Parse(strs[0]); this.Unit = (Global.UnitType) int.Parse(strs[1]); } else { this.Value = 0; this.Unit = Global.UnitType.Value; } }
/// <summary> /// 复制构造函数 /// </summary> /// <param name="value"></param> public ValueUnit(ValueUnit value) { this.Value = value.Value; this.Unit = value.Unit; }
/// <summary> /// 构造函数 /// </summary> /// <param name="v">数值</param> /// <param name="u">单位(0数值,1百分比)</param> public ValueUnit(long v, int u) { this.Value = v; this.Unit = (Global.UnitType)u; }
/// <summary> /// 构造函数 /// </summary> /// <param name="v">数值</param> /// <param name="u">单位(0数值,1百分比)</param> public ValueUnit(long v, string u) { this.Value = v; this.Unit = (Global.UnitType) int.Parse(u); }
/// <summary> /// 构造函数 /// </summary> /// <param name="v">数值</param> /// <param name="u">单位</param> public ValueUnit(long v, Global.UnitType u) { this.Value = v; this.Unit = u; }