Created
September 16, 2015 20:41
-
-
Save vkbandi/901b9848758737cba5b5 to your computer and use it in GitHub Desktop.
Resizing an array at runtime in C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int myArray = new int[0]; | |
for (int i = 0; i < 10; i++) | |
{ | |
Array.Resize(ref myArray, myArray.Length+1); | |
myArray[myArray.Length - 1] = i; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment