3
Reply

How do I insert multiple datatype in generic arrraylist

hemalatha cmr

hemalatha cmr

Apr 18 2009 5:22 AM
5.1k
I am learning generics. I tried to include some elements this way.
List<int> list = new List<int>();
for (int i=0; i<10; i++)
{
list.Add(i);
}
This works.
Now actually i want different types of data to be included
I want to include empno integer,empname string, dateofjoining date, salary double all these in a generic arraylist.
How should I do that, i.e. passing different datatypes in a single generic arraylist.
Kindly help

Answers (3)