no need for foreach loop do it like this
Dictionary<string,string> dic = new Dictionary<string,string>();
dic.Add("1", "abc");
dic.Add("2", "bcd");
dic.Add("3", "nadeem");
string dicvalue = "";
if (dic.ContainsKey("3"))
{
dic.TryGetValue("3", out dicvalue);
}
else
{
}