What is List?

1/8/2020 3:43:38 AM

List is a collection of data. It is generic data type. List like strongly typed. We use generic data from the list. We can’t need to initialize the size of list. It is dynamically creating the size or index by the data. We can set the capacity of the list by the set the value of the list. We can call this list is Collections. Now given bellow the example code of the generic type list.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using testForClass1;

namespace testFor
    class Program
        static void Main(string[] args)
            List<Int32> myList = new List<int>();
            foreach (int data in myList)
                Console.WriteLine("The value are : "+data+" Type of: "+data.GetType());
            List<double> myListCapacity = new List<double>(5);


In this section I was show the list. First create a list name as myList. This list type is integer. We can specify the list type so it is strongly type. In this section we can specify the capacity of the list by pass the parameter.