[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;

你可能感兴趣的:(项目的那些JJYY,WinForm)