public override void HandleAttr(string attr) { String[] _attr = attr.Split(';'); if (_attr.Length != 3) { Console.WriteLine("交流电源参数读取失败"); } else { frequency = int.Parse(_attr[0]); pp_value = int.Parse(_attr[1]); powermode = (Powermode)Enum.Parse(typeof(Powermode), _attr[2]); //这里强制类型转换 } }
public ACPower() : base() { pp_value = 0; frequency = 0; powermode = 0; }
public ACPower(Powermode _powermode, double _frequency, double _pp_value) : this() { frequency = _frequency; pp_value = _pp_value; powermode = _powermode; }