示例#1
0
 public void RemoveUnit(Unit unit)
 {
     try
     {
         _units.Remove(unit);
     }
     catch (IndexOutOfRangeException ex)
     {
         throw new InvalidOperationException("Could not find Unit " + unit.ToString(), ex);
     }
 }
示例#2
0
 public void RemoveUnit(Unit unit)
 {
     try
     {
         _units.Remove(unit);
     }
     catch (IndexOutOfRangeException ex)
     {
         throw new InvalidOperationException("Could not find Unit " + unit.ToString(), ex);
     }
 }
示例#3
0
 public void AddUnit(Unit unit)
 {
     if (!_units.Contains(unit))
     {
         _units.Add(unit);
     }
     else
     {
         throw new InvalidOperationException("Unit " + unit.ToString() + " already exists!");
     }
 }
示例#4
0
 public void AddUnit(Unit unit)
 {
     if (!_units.Contains(unit))
     {
         _units.Add(unit);
     }
     else
     {
         throw new InvalidOperationException("Unit " + unit.ToString() + " already exists!");
     }
 }