You can do this making array list
Adding Elements in the Array List:
//this line we have added object of DateTime class
Now we have added three elements of different data type and one object of DateTime class. Add() function from the Array List adds new item to the Array List.
Getting Size of the Array List:
By using the property Count of Array List object we can get the size of Array List. As we have added three items because size of the Array List is 3. The size will be stored in a variable named size.
Accessing Items from the Array List:
The main task is to access the items back from Array List. One thing must be kept in mind while accessing the item that we have to cast each item into its proper data type or object.
As we have inserted integer first so we can access it from Array List as follows:
//0 based indexing
int b = (int)newlist;
string t=newlist as string;
Clearing Array List:
We can clear and delete the all elements of list as follows.