Hi Martin,
If a "dictionary" or some hypothetical class were to contain two keys with
identical values, how would the object determine which value should be
returned when the key is supplied to an indexer?
It sounds like what you need is a single key with an array of values such
as the following, which uses the generic Dictionary class in the 2.0
Framework:
Dictionary<string, string[]> keysWithMultiValues
= new Dictionary<string, string[]>();
keysWithMultiValues.Add("a key",
new string[] { "value 1", "value 2" });
string[] values = keysWithMultiValues["a key"];
The order of the values will be maintained so you can index into them as
such:
string value1 = keysWithMultiValues["a key"][0];
string value2 = keysWithMultiValues["a key"][1];
--
Dave Sexton
http://davesexton.com/blog
Martin Hart said:
Hi:
I need to use a Dictionary structure, but I need the key value to be
duplicable. What generic collection can I use for this?
TIA,
Martin.