For one-to-one I can use Hash or dictionary. Forexample Smith is 26 years old, Brown is 35 years old. This is clear. What about one to many? Forexample Smith is attending class01, class08, class12 and Brown is attending class01, class05, and class08. What are my alternatives and what is the best choice?
You can still use a Dictionary
, but you need to make the value type a collection, ie: Dictionary<Person, IList<Class>>
. This would allow you to store a list of classes per person.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With