Turner I.A. LabWork04 #4
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user