public int GetGoodQt(Good.TYPE _type) { foreach (Good _good in _goods) { if (_good.Type == _type) { return(_good.Quantity); } } return(0); }
public void AddGood(Good.TYPE _type, int _quantity) { bool isPresent = false; foreach (Good gd in _goods) { if (gd.Type == _type) { isPresent = true; gd.Add(_quantity); break; } } if (!isPresent) { _goods.Add(new Good(_type, _quantity)); } }