Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void Insert(T elt)
- {
- if (nbElements >= array.GetLength(0))
- {
- T[] newArray = new T[array.GetLength(0) * 2];
- for (int i = 0; i < array.GetLength(0); i++)
- {
- newArray[i] = array[i];
- }
- array = newArray;
- }
- array[nbElements] = elt;
- nbElements++;
- }
- public T At(int i)
- {
- if (i > -1 && i < nbElements)
- return array[i];
- else
- throw new Exception("Index error");
- }
Advertisement
Add Comment
Please, Sign In to add comment