How to avoid using List <List <T>>?
I have a WCF service that I cannot touch that returns List<FilesWithSettings>. I need to enter several PCs that are grouped together and retrieve List<FilesWithSettings>for each of them along with PCIdentifier, which leads me to Dictionary<PCIdentifier,List<FilesWithSettings>>or List<PCIdentifier>and List<List<FilesWithSettings>>which are not elegant and unreadable.
Can you give me a more elegant solution?
+5
3 answers
I think you have three options:
List<List<T>> // Which is pretty nasty
or
Dictionary<PCIdentifier, List<T>>
Which says better about your intentions or even:
class PCResult
{
PCIdentifier Identifier { get; set; };
List<T> Results { get; set; }
}
and
List<PCResult>
Personally, I prefer the third, but the second is also good.
+6