December 2018
Beginner to intermediate
668 pages
15h 30m
English
The generic list is a strongly typed list of elements that is accessed using an index. In contrast to arrays, generic lists are expandable, and the list can grow dynamically; for this reason, they are known as dynamics arrays or vectors. Unlike arrays, generic lists are one dimensional, and are one of the best options for manipulating an in-memory collection of elements.
We can define a generic list as shown in the following code example. The code phrase lstNumbers allows only integer values to be stored, the phrase lstNames stores the only string, personLst stores Person objects, and so on:
List<int> lstNumbers = new List<int>(); List<string> lstNames = new List<string>(); List<Person> personLst = new List<Person>(); HashSet<int> ...
Read now
Unlock full access