+ 2
C# Array Of Lists VS List Of Arrays
Is it better to use array of lists or list of arrays?
6 Answers
+ 1
The truth is there is not one good way, there are several ways to do it.
The one that is working is a good way.
If it is not working or to slow, you can try to find a other way.
You do give little information about you situation.
Do you know the number of elements ?
I find array's not flexible enough. I find it hard to assign elements and to change elements.
I really like lists, where I have lots of methods helping me to add, remove or change elements.
So I would use a list of lists.
+ 5
Well - I don't have much experience with C#. But I'll answer with my knowledge of java - C# and java are very identical to each other đ
So you may use lists of arrays when you need better control on the things that contains some arrays and vice-versa.
+ 1
It depends on what are you going to do
0
So when I should use array of lists and when list of arrays?
0
First you need to know much elements you have. Fixed or dynamic
If it is fixed you can use array
If it is dynamic you will use lists
Array seems to be faster
Lists are more flexibel.
https://www.sololearn.com/discuss/1754445/?ref=app
I daily life I only use list, but that can depend on the type of programming you do.
0
I know what's the difference between array and list. My problem can be solved by using array of lists or list of arrays. And here comes the question: is it better to use an array of lists or a list of arrays?