Using Hashtable I want to have multiple objects mapped to the same key. E.g. Key is ‘Age’ and Values are ojects of struct ‘Student’.
I suppose perceptually there will be a sort of linked list with Key acting as a ‘Head’
25->obj1->obj2->obj3
Here are my questions:
Is the above representation correct?
If not, which data structure can be
used for achieving the same?Can I look up for a specific field on the above data representation. e.g. One I reach the key 25, I look for the name ‘Scott’ in the row. Will I be able to stop/ get a pointer to the object containing the field Scott?
Thanks!
If you’re using C#, the best option would probably be (which, essentially, is what you’re proposing):
Assuming Age and Student are both types.