lab8 some minor fixes
This commit is contained in:
parent
179681f849
commit
d3abdb424d
@ -2,6 +2,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -28,14 +29,14 @@ namespace ProjectBattleship.Generics
|
||||
{
|
||||
if (_places.Count == _maxCount)
|
||||
throw new StorageOverflowException(_maxCount);
|
||||
if (!(position >= 0 && position < Count))
|
||||
throw new Exception("Неверная позиция для вставки");
|
||||
if (!(position >= 0 && position <= Count))
|
||||
throw new Exception($"Неверная позиция для вставки");
|
||||
if (equal != null)
|
||||
{
|
||||
if (_places.Contains(ship, equal))
|
||||
throw new ArgumentException(nameof(ship));
|
||||
}
|
||||
_places[position] = ship;
|
||||
_places.Insert(position, ship);
|
||||
}
|
||||
public void SortSet(IComparer<T?> comparer) => _places.Sort(comparer);
|
||||
public void Remove(int position)
|
||||
|
Loading…
Reference in New Issue
Block a user