小弟想把一个LISTBOX中选中的项移动到另一个LISTBOX中,但当第2次进入这个循环时就提示了错误,主要就是指出的274行出错,请问正确的代码应该怎么写?请达人给出正确的代码写法
  if(listBoxElement.SelectedItem!=null)
                      {
foreach(ListItem listItem in listBoxElement.Items)
                                {
                                  if(listItem.Selected)
                                 {
   listBoxElement.Items.Remove(listItem);
   listBoxGatherEle.Items.Add(listItem);
   if(listBoxGatherEle.Items.Count>0)
   {
listBoxGatherEle.SelectedIndex=listBoxGatherEle.Items.Count-1;
   }
                                 }
                              }
}
集合已修改;枚举操作可能不会执行。 
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.InvalidOperationException: 集合已修改;枚举操作可能不会执行。源错误: 
行 272: if(listBoxElement.SelectedItem!=null)
行 273: {
行 274: foreach(ListItem listItem in listBoxElement.Items)
行 275: {
行 276: if(listItem.Selected)