Reputation: 13602
I'm using:
List<string[]>
which works, but just feels so wrong! Does anyone have any correct more up date ways to achieve this or is it not wrong? I have tried the following, which works but also feels wrong:
List<List<string>>
For any moaners out there, my definition of wrong is hacky, out of date, old code, over complicated code, etc
Thanks
Edit:
Sorry guys, I forgot to mention the list length is un-known so it's likely to be large list with a non specified number of items, each array will consist of around 10-20 items
Upvotes: 2
Views: 3554
Reputation: 1270
I would put
List<string>
inside a class then use
List<Class>
Upvotes: 0
Reputation: 1574
the list length is un-known
If you don't know the length why not use List<List<string>>
?
As mentioned before it's neither wrong nor hacky or overcomplicated. It's exactly what you need. A list of unknown length that contains lists of strings.
Upvotes: -1
Reputation: 203821
There isn't anything wrong with either of them, in the general case. There are certainly specific cases where one or the other may not be appropriate, but without any details there is no way of knowing whether this is an appropriate usage.
It's certainly not a pattern that you would globally consider bad. There's simply no reason for that to be the case.
Upvotes: 4