Generic Collections
Now that we’ve covered arrays it’s time to look at the use of generic collections. A generic collection allows the developer to create a strongly-typed collection by specifying a data type upon declaration. As data is being added or retrieved from the collection, the compiler will validate the statement to ensure that the data type conforms to the one specified in the declaration. This is a much better alternative than declaring the arrays that we saw before since collections dynamically grow and shrink based on the amount of data being contained. As you recall, arrays required a size to be specified upon creation whereas these collections do not require a size.
You must sign up to see the rest of this content.