The two types you are referring to are:
- A type of
Collection
called aList
, which would be defined asList aList = new List {"first" , "second"}
- An array, defined as
string[ ] aList = {"first", "second"}
An array is a fixed-length, i.e. you typically define it saying it will contain a set number of Strings. A List
, by contrast, will keep growing as you add elements (in the background, it stores the data in a dynamic array (i.e. one that grows and shrinks with the List
).
There are a lot of other collections you can use too, a List
isn’t the only one; and it depends how you want to represent your data.
Have a look at the Microsoft Documentation for Selecting a Collection class