Use TryGetValue to get a value out
using System;
using System.Collections.Generic;
public class Example
{
public static void Main()
{
Dictionary<string, string> openWith = new Dictionary<string, string>();
openWith.Add("A", "a");
openWith.Add("B", "b");
openWith.Add("C", "c");
string value = "";
if (openWith.TryGetValue("AAAA", out value))
{
Console.WriteLine(value);
}
else
{
Console.WriteLine(" is not found.");
}
}
}
Related examples in the same category