Arrays and Lists
As in C/C++, C# includes arrays though it also includes classes to help you manage collections.
Arrays are fixed size, but do include member functions that allow you to query the array for its Length amongst other things.
The ListSystem.Collections.Generic
namespace is the equivalent of the dynamic array we created in the member functions chapter.
In C
Example
This first example shows how to use the array class to work with a fixed size array.
If you want a variable length array, then you use a List. This is like the dynamic array from Part 2, and uses generics to allow you to configure what it stores. The following creates a List of strings, and keeps adding to it while the user enters data. Notice that the List class uses a Count
property to give you access to the number of elements it contains.