Terminology
Term | Definition |
---|---|
Array | An ordered collection of items denoted by [] . For example: string[] names = new string[] { "Mark", "Paula", "Sandy" , "Bill" }; |
List | An ordered collection of items denoted by new List<VariableType>() . Lists are more flexible than Arrays and can be altered. For example: var names = new List<string>() { "Mark", "Paula", "Sandy" , "Bill" }; |
Getting Specific Elements from an Array or List | To access a specific element within a List or Array use the [] . For example: var firstName = names[0]; |
names.Count; | The .Count property counts the amount of items within a list. |
names.Add(); | The .Add() method adds a variable of the same data type to the list. |