[c#ノート]Dictionaryファジイ検索


Dictionary<string, string> dic = new Dictionary<string, string>();
dic.Add("ABCD", "1111");
dic.Add("ABCE", "2222");
dic.Add("ABCF", "3333");
dic.Add("BCDD", "4444");
var v = from d in dic where d.Key.StartsWith("ABC") select d;

string s = String.Empty;

foreach (var k in v)
{
    s += k.Value + "|";
}

textBox1.Text = s;