+ 1

How do you put an arraylist inside an arraylist in c#?

I am looking for a container that can hold containers of multiple data types in c#. Is it possible to do that with an arraylist? Ive tried it and it doesnt seem to be working.

29th Aug 2020, 1:27 PM
Francis
2 Réponses
+ 2
Declare var myList = new List<dynamic>(); Then add different generic List with different T to myList Check out this code. var myList = new List<dynamic>(); myList.Add(new List<string> { "a", "b" }); myList.Add(new List<int> { 1, 2, 3 }); myList.Add(new List<string> { "apple", "orange", "durian" }); myList.Add(new List<char> { 'a', 'b' }); https://code.sololearn.com/cDPDnYw0Ued7/?ref=app
29th Aug 2020, 4:12 PM
Calviղ
Calviղ - avatar
+ 1
Thank you very much
30th Aug 2020, 12:22 AM
Francis