Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public int? this[int index] // indexer
- {
- get
- {
- return dynamicArray[index];
- }
- set
- {
- if (index > dynamicArray.Length) {
- int?[] temp = new int?[index + 1]; // create temp array
- for (int i = 0; i < dynamicArray.Length; i++) {
- temp[i] = dynamicArray[i]; // copying content of array to temp array
- }
- dynamicArray = temp; // creating new array with new size
- temp = null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment