Edit item in BindingList<T>

4.8k views Asked by At

it is code edit item in list

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

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

please convert in code for BindingList

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

thanx

1

There are 1 answers

3
digEmAll On

Something like this ?

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