"I have discussed here about ArrayList but there is a disadvantage of using ArrayList.We can't customize data type in ArrayList that means we can add any kind of data type in it which is not a good process for OOP.

So instead of using ArrayList we can use List<DataType> in which we can define data type."

class Program
{
public static void Main()
{
        List<int> list = new List<int>();
        list.Add(2);
        list.Add(3);               // Add two integers in List<int>

        Example(list);           // Here Example is a method
}

static void Example(List<int> list)
{
       foreach(int abc in list)
      {
            Console.Writeline(abc);
            Console.ReadLine();
       }
 }
}
OUTPUT :
2
3