编辑BindingList <t> </t>中的项目

时间:2011-02-06 18:11:59

标签: c# .net bindinglist

是列表中的代码编辑项

List<class1> lst = new List<class1>();

int index = lst.FindLastIndex(s => s.Number == textBox6.Text);
if(index != -1) { lst[index] = new Class1() { ... }; }

请转换为BindingList的代码

BindingList<class1> lst = new BindingList<class1>();

感谢名单

1 个答案:

答案 0 :(得分:4)

这样的东西?

var item = bindingList.Select((Item,Index) => new { Item, Index })
                      .LastOrDefault(x => x.Item.Number == textBox6.Text);
if (item != null)
{
    bindingList[item.Index] = new Class1() { ... };
}