...

/

ArrayList

ArrayList

Learn to use a dynamically-sized collection instead of arrays.

Introduction

When we need to store multiple items in one place, we can use arrays. We can use them to store a number items of the same type:

int[] points = new int[30]; // Array that can hold 30 integers

We can also iterate an array to process one item at a time:

for (int i  = 0; i < points.Length; i++)
{
	Console.WriteLine(points[i]);
}

Arrays are great, but they all suffer from one major ...