I have a dictionary, for example Dictionary<int, string>
.
What would be the best way to get the string value if I know the key?
If you know the key is in the dictionary:
value = dictionary[key];
If you're not sure:
dictionary.TryGetValue(key, out value);
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