Исправление

This commit is contained in:
H0llowVoid 2024-06-10 09:52:13 +04:00
parent 9ac1ae9ee2
commit fa88a6d316

View File

@ -50,11 +50,6 @@ public class ListGenericObjects<T> : ICollectionGenericObjects<T>
} }
public T? Get(int position) public T? Get(int position)
{ {
// TODO проверка позиции
if (position < Count && position >= 0)
{
return _collection[position];
}
if (position < 0 || position >= Count) throw new PositionOutOfRangeException(position); if (position < 0 || position >= Count) throw new PositionOutOfRangeException(position);
if (_collection[position] == null) throw new ObjectNotFoundException(position); if (_collection[position] == null) throw new ObjectNotFoundException(position);
return null; return null;