Answer the question
In order to leave comments, you need to log in
How to refer to a key element in a dictionary?
Have a dictionary
var wordCount = new Dictionary<KeyValuePair<string, string>, int>();
Answer the question
In order to leave comments, you need to log in
1. If we are talking ONLY about the key, why do you need to know what dictionary you have? Either you gave too much information, or you didn’t ask what you really wanted.
2. The question boils down to how to get the "first" element from the KeyValuePair. This can be done using the Key property. In general, read about tuples (which are built-in, in parentheses), and do it humanly:
Access to the first element in this case is the Item1 property.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question