How can I convert BindingList to List ?
Convert BindingList<MyObject> to List<MyObject> c#
Asked Answered
Try this
List<int> list = yourBindingList.ToList();
int is your type =)
I don't see a ToList() or Cast() method with my BindingList nor in MSDN. Is this a different BindingList than System.ComponentModel.BindingList<T>? –
Knapsack
@RichShealer - A bit late but you need to make sure you add the using System.Linq; ToList() is an extension method. –
Generate
If you're using .NET 2.0, then this is the solution:
public List<T> ToList()
{
return new List<T>(this); // this - is a BindingList compatible object
}
© 2022 - 2024 — McMap. All rights reserved.
List
? – Immensity