Skip to content

Instantly share code, notes, and snippets.

@vkbandi
Created September 16, 2015 20:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vkbandi/901b9848758737cba5b5 to your computer and use it in GitHub Desktop.
Save vkbandi/901b9848758737cba5b5 to your computer and use it in GitHub Desktop.
Resizing an array at runtime in C#
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