var myKey = myDict.FirstOrDefault(x => x.Value == "myValue").Key;
// return the first key finded in the dict associated to this value
Dictionary<string, string> dict = new Dictionary<string, string>();
dict.Add("UserID", "test");
string userIDFromDictionaryByKey = dict["UserID"];
Dictionary<string, string> dict = new Dictionary<string, string>()
{
{"1", "one"},
{"2", "two"},
{"3", "three"}
};
foreach (var item in dict)
{
if(item.Value == "One")
{
var firstElementKey = item.Key;
Console.WriteLine(firstElementKey);
}
}