Can i replace the following with a tuple and a list. Will there be any dip in performance or what is the best alternative.
1. Dictionary<string, Dictionary<string, User>>
Can I change this to the following
2. Dictionary<string, Tuple<string, Address>> userdata
Kindly suggest.
Note: There seems to be no way to group tuples, so i think that 2 may be better be replaced by 1.
Tuple will hold exactly one pair of values. Dictionary will hold an arbitraty number of such pairs. So of course 1 and 2 are not equivalent – one holds a collection of collections of pairs, another just a collection of pairs.
slugster is correct: you can group a list of tuples using linq
GroupBymethod.