I have a requirement to implement some kind of dictionary object. Something like MyDict<K,V1, V2). For example if I have a Question as Key(k) then Correct answer is V1 . V2 is user selected answer. Is there a collection that would satisfy this requirement in C#. If I have to design my own type, what interfaces should I implement. ICollection and Ilist ?
I have a requirement to implement some kind of dictionary object. Something like MyDict<K,V1,
Share
If you are using .NET 4, there are several generic
Tupleclasses that you can use.So, you can use:
In earlier versions, you could use
KeyValuePair<T1,T2>as the second generic type: