Answers for "c# find in dictionary by key"

C#
0

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
0

c# find in dictionary

if (_tags.TryGetValue(tag, out string myValue))
{
    // use myValue;
}
// use myValue, still in scope, null if not found
Posted by: Guest on July-21-2021

Code answers related to "c# find in dictionary by key"

C# Answers by Framework

Browse Popular Code Answers by Language