fix: update DogsContainer.Insert
This commit is contained in:
parent
eb8e213eb6
commit
a125e85209
@ -57,6 +57,10 @@ namespace Lab3.Exercises.Register
|
|||||||
|
|
||||||
public void Insert(int index, Dog dog)
|
public void Insert(int index, Dog dog)
|
||||||
{
|
{
|
||||||
|
if (Count == Capacity)
|
||||||
|
{
|
||||||
|
EnsureCapacity(Capacity * 2);
|
||||||
|
}
|
||||||
for (int i = Count+1; i > index; i--)
|
for (int i = Count+1; i > index; i--)
|
||||||
{
|
{
|
||||||
dogs[i] = dogs[i-1];
|
dogs[i] = dogs[i-1];
|
||||||
|
Loading…
Reference in New Issue
Block a user