public void Add(InvObject obj) { if (Used < totalSize) { arr[Used] = obj; } Used++; }
public void Insert(int position, InvObject obj) { if (position == Used + 1) { arr[position] = obj; } if (position <= Used) { int x = 0; while (position + x < Used) { arr[Used - x] = arr[Used - 1 - x]; x++; } arr[position] = obj; Used++; } }