Click here to Skip to main content
16,005,281 members
Home / Discussions / C#
   

C#

 
GeneralRe: Continued Values Collection/List/Dictionary Pin
Som Shekhar18-Dec-09 18:59
Som Shekhar18-Dec-09 18:59 
GeneralRe: Continued Values Collection/List/Dictionary Pin
Eddy Vluggen19-Dec-09 0:48
professionalEddy Vluggen19-Dec-09 0:48 
GeneralRe: Continued Values Collection/List/Dictionary Pin
Som Shekhar19-Dec-09 2:28
Som Shekhar19-Dec-09 2:28 
GeneralRe: Continued Values Collection/List/Dictionary Pin
Eddy Vluggen19-Dec-09 9:41
professionalEddy Vluggen19-Dec-09 9:41 
GeneralRe: Continued Values Collection/List/Dictionary Pin
Som Shekhar19-Dec-09 20:16
Som Shekhar19-Dec-09 20:16 
GeneralRe: Continued Values Collection/List/Dictionary Pin
Eddy Vluggen20-Dec-09 5:54
professionalEddy Vluggen20-Dec-09 5:54 
GeneralRe: Continued Values Collection/List/Dictionary Pin
Som Shekhar20-Dec-09 18:22
Som Shekhar20-Dec-09 18:22 
AnswerRe: Continued Values Collection/List/Dictionary [modified] Pin
Gideon Engelberth16-Dec-09 15:05
Gideon Engelberth16-Dec-09 15:05 
I do not believe that there is something built into the framework. There may be something in the big wide internet, but I'm not sure what I'd use to look it up.

Are the items all indexed concsecutively? If so, you will probably want to look for something that implements IList instead of IDictionary. The reason other people suggested Dictionary is probably because you said your list had "keys" and "values" implying possible non-consecutive indexes.

Making such a collection yourself is not that hard. I put together a sample of how I would do it. It turned out to ~400 lines, most of which were boilerplate. The Tuple class from .NET 4.0 would be helpful here, but you could create one yourself pretty easily. My sample class definition was:
C#
public class DeltaCollection<T1, T2, T3> :
       IList, 
       IList<Tuple<T1, T2, T3>>, 
       IList<Tuple<T1?, T2?, T3?>>
       where T1 : struct, T2 : struct, T3 : struct

(I did it in VB, so I may have messed up the generic constraint syntax.)

Update
I played around some more and was able to get it down to ~200 lines +15-30 lines per tuple size (number of values per row) you want to support. Again, this would be benefited greatly by .NET 4.0's Tuple class, which had to be reimplemented to use in my class now. The main difference between this version and the original is that the Item property and foreach enumerator will now return Tuple<T1?, T2?, T3?> instead of Tuple<T1, T2, T3>.

modified on Wednesday, December 16, 2009 11:04 PM

GeneralRe: Continued Values Collection/List/Dictionary Pin
Som Shekhar16-Dec-09 19:15
Som Shekhar16-Dec-09 19:15 
GeneralRe: Continued Values Collection/List/Dictionary Pin
Gideon Engelberth17-Dec-09 3:31
Gideon Engelberth17-Dec-09 3:31 
GeneralRe: Continued Values Collection/List/Dictionary Pin
Som Shekhar17-Dec-09 3:42
Som Shekhar17-Dec-09 3:42 
AnswerRe: Continued Values Collection/List/Dictionary [modified] Pin
BillWoodruff16-Dec-09 16:55
professionalBillWoodruff16-Dec-09 16:55 
GeneralRe: Continued Values Collection/List/Dictionary Pin
Som Shekhar16-Dec-09 19:17
Som Shekhar16-Dec-09 19:17 
GeneralRe: Continued Values Collection/List/Dictionary Pin
Som Shekhar16-Dec-09 19:19
Som Shekhar16-Dec-09 19:19 
GeneralRe: Continued Values Collection/List/Dictionary Pin
BillWoodruff16-Dec-09 19:41
professionalBillWoodruff16-Dec-09 19:41 
GeneralRe: Continued Values Collection/List/Dictionary Pin
Som Shekhar18-Dec-09 19:02
Som Shekhar18-Dec-09 19:02 
Questionproblem with the tcp connetion. Pin
prasadbuddhika16-Dec-09 6:24
prasadbuddhika16-Dec-09 6:24 
AnswerRe: problem with the tcp connetion. Pin
Paulo Zemek16-Dec-09 9:11
Paulo Zemek16-Dec-09 9:11 
QuestionSetup and Deployment Issue! Pin
Sr...Frank16-Dec-09 3:46
Sr...Frank16-Dec-09 3:46 
AnswerRe: Setup and Deployment Issue! Pin
Keith Barrow16-Dec-09 4:43
professionalKeith Barrow16-Dec-09 4:43 
AnswerRe: Setup and Deployment Issue! Pin
Seishin#16-Dec-09 4:46
Seishin#16-Dec-09 4:46 
GeneralRe: Setup and Deployment Issue! Pin
Sr...Frank16-Dec-09 8:49
Sr...Frank16-Dec-09 8:49 
GeneralRe: Setup and Deployment Issue! Pin
Keith Barrow16-Dec-09 9:10
professionalKeith Barrow16-Dec-09 9:10 
GeneralRe: Setup and Deployment Issue! Pin
Sr...Frank16-Dec-09 9:16
Sr...Frank16-Dec-09 9:16 
GeneralRe: Setup and Deployment Issue! Pin
Seishin#16-Dec-09 9:31
Seishin#16-Dec-09 9:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.