3
Answers

How do I insert multiple datatype in generic arrraylist

hemalatha cmr

hemalatha cmr

15y
5.1k
1
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)