I fetch multiple records with the same id and I want to store them in a Hashtable in C#. I’m using the id as the key in the Hashtable, and the value is the object itself. It throws an exception because the same key is added again. Is there a way to fix this problem?
This is my code:
Hashtable localItemsIndex = new Hashtable();
foreach (TzThing thing in localThingz)
localItemsIndex.Add(thing.Id, thing);
Thanks in advance
jennie
Maybe you should use
Dictionary<Id,List<TzThing>>to store multiple values for one key