Turner I.A. LabWork04 #4

Merged
eegov merged 4 commits from LabWork04 into LabWork03 2022-10-14 09:21:21 +04:00
Showing only changes of commit 40f345bcb8 - Show all commits

View File

@ -56,7 +56,7 @@ namespace AntiAircraftGun
/// <returns></returns>
public int Insert(T antiAircraftGun, int position)
{
if (position < 0 || position > _places.Count) return -1;
if (position < 0 || position >= _places.Count) return -1;
_places.Insert(position, antiAircraftGun);
return position;
}
@ -67,7 +67,7 @@ namespace AntiAircraftGun
/// <returns></returns>
public T Remove(int position)
{
if (position < 0 || position > _places.Count) return null;
if (position < 0 || position >= _places.Count) return null;
if (_places[position] == null) return null;
T removed = _places[position];
_places.RemoveAt(position);
@ -82,12 +82,12 @@ namespace AntiAircraftGun
{
get
{
if (position < 0 || position > _places.Count) return null;
if (position < 0 || position >= _places.Count) return null;
return _places[position];
}
set
{
if (position < 0 || position > _places.Count) return;
if (position < 0 || position >= _places.Count) return;
_places.Insert(position, value);
}
}