首先转换为IList;
再就是将IList转换为List
System.Collections.IList items = (System.Collections.IList)ListBMain.SelectedItems; //首先转换为IList
if (items != null && items.Count > 0)
{
ListShihaoOut = items.Cast<XuanzeShihao>().ToList();
this.DialogResult = true;
}
else
{
MessageBox.Show("请选择数据!","系统提示:",MessageBoxButton.OK,MessageBoxImage.Hand);
}