遍历并修改dictionary的值

var dictionary = clb_Select.Items.Cast<object>().ToDictionary(item => item.ToString(), item => false);

foreach (var checkedItem in clb_Select.CheckedItems)
{
if (dictionary.ContainsKey(checkedItem.ToString()))
{
dictionary[checkedItem.ToString()] = true;
}
}

posted @ 2013-10-23 15:20  Seaurl  阅读(653)  评论(0编辑  收藏  举报