0.8.1
This commit is contained in:
parent
c0a2c582e8
commit
977c6de6f6
@ -23,15 +23,16 @@ namespace SelfPropelledArtilleryUnit.Basic
|
||||
}
|
||||
public bool Insert(T MilitaryUnit, IEqualityComparer<T>? equal = null)
|
||||
{
|
||||
if (places.Count == maxCount)
|
||||
return false;
|
||||
Insert(MilitaryUnit, 0);
|
||||
return true;
|
||||
return Insert(MilitaryUnit, 0, equal);
|
||||
}
|
||||
public bool Insert(T MilitaryUnit, int index, IEqualityComparer<T>? equal = null)
|
||||
{
|
||||
if (!(index >= 0 && index <= Count && places.Count < maxCount))
|
||||
return false;
|
||||
if (places.Count == maxCount)
|
||||
throw new StorageOverflowException(index);
|
||||
if (equal != null && places.Contains(MilitaryUnit, equal))
|
||||
throw new ArgumentException("Добавленный объект присутствует в коллекции");
|
||||
places.Insert(index, MilitaryUnit);
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user