转换的IList< T>到的BindingList< T> [英] Convert IList<T> to BindingList<T>
本文介绍了转换的IList< T>到的BindingList< T>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的C#程序,我有一个返回的IList℃的方法;客户>
名单,我怎么可以把它转换为的BindingList<客户> ?
解决方案
VAR yourList =新的List<客户> ();
变种listBinding =新的BindingList<客户>(yourList);
您不需要做演员,只需要提供的BindingList< T>
类的构造函数与的IList< T>
,你有
In my c# program, I have a method that return an IList<Customer>
list, how can I cast it to BindingList<Customer>
?
解决方案
var yourList = new List<Customer>();
var listBinding = new BindingList<Customer>(yourList);
You don't need to do a cast, just provide the BindingList<T>
class constructor with IList<T>
, which you have.
这篇关于转换的IList< T>到的BindingList< T>的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文