Answers for "c# dictionary does it have key"

C#
6

c sharp check if key in dictionary

// To check if a dictionary has a certain key, use 'ContainsKey()'
dict.ContainsKey(key);
Posted by: Guest on February-26-2020
-1

get key in dictionary c#

public static void Main()
{
    Dictionary<string, string> dict = new Dictionary<string, string>()
    {
        {"1", "one"},
        {"2", "two"},
        {"3", "three"}
    };

    string key = KeyByValue(dict, "two");       
    Console.WriteLine("Key: " + key);
}
Posted by: Guest on November-05-2021

Code answers related to "c# dictionary does it have key"

C# Answers by Framework

Browse Popular Code Answers by Language