将 IList<T> 转换为 BindingList<T>

29

如何将 IList<Customer> 列表转换为 BindingList<Customer>

1个回答

100
var yourList = new List<Customer>();
var listBinding = new BindingList<Customer>(yourList);

BindingList 构造函数

您无需进行强制类型转换,只需将 IList<T> 传递给 BindingList<T> 类的构造函数即可,而您已经拥有它。


由于在LINQ中没有ToBindingList()方法,您能为这些情况回答问题吗?类似这样的: BindingList<cRecord> cr = cRecords.Take(TotalDays).ToList(); - MC9000

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接