Examining the List Type
Like nongeneric classes, generic classes are created with the new keyword and any required con-
structor arguments. In addition, you are required to specify the type(s) to be substituted for the type
parameter(s) defined by the generic type. For example, System.Collections.Generic.List
requires you to specify a single value that describes the type of item the List will operate upon.
Therefore, if you wish to create three List objects to contain integers and SportsCar and Person
objects, you would write the following:
static void Main(string[] args)
{
Do'stlaringiz bilan baham: |