日期:2014-05-17  浏览次数:21079 次

2个ListBox怎么比较项内容?

我想ListBox3添加 ListBox1不包含的ListBox项的‘杀星’。这个要怎么比较?
 for (int j = 0; j < this.listBox1.Items.Count; j++)
            { 
                for (int i = 0; i < this.listBox2.Items.Count; i++) 
                {
                    if (listBox1比较ListBox)
                    {
                        this.listBox4.Items.Add....
                    }
                } 
            }
------解决方案--------------------
			foreach (var each in this.listBox1.Items) {
foreach (var eac in this.listBox2.Items) {
if(each.ToString()!=eac.ToString())
this.listBox3.Items.Add(eac.ToString());
}
}