IList跟IList<>的困扰,编译不过

IList和IList<>的困扰,编译不过
我有下面几行很简单的代码,想把我自己初始化的一个IList<>赋值给bindingSource的List属性。这个属性的类型我看定义就是IList

    public partial class Form1 : Form
    {
        private IList<string> m_List = new[] {"abc", "xyz"};
        public Form1()
        {
            InitializeComponent();
            this.bindingSource1.List = m_List;
        }
    }

编译错误有两个:
error CS0200: Property or indexer 'System.Windows.Forms.BindingSource.List' cannot be assigned to -- it is read only
error CS0266: Cannot implicitly convert type 'System.Collections.Generic.IList<string>' to 'System.Collections.IList'. An explicit conversion exists (are you missing a cast?)

我的代码应该如何修改呢?
------解决方案--------------------
第一,System.Windows.Forms.BindingSource.List  是只读的,不允许给赋值


第二,System.Collections.Generic.IList<string> 和System.Collections.IList 不是相同的类型,不能赋值
------解决方案--------------------
只读不能赋值的...
------解决方案--------------------
LIST继承自ILIST,但是它们毕竟不是一个类型
试试强制转换,如果不行,只能把你定义的ILIST改成LIST了
------解决方案--------------------
首先bindingSource1.List是只读属性,不能用来set,其次你要绑定需要用bindingSource1.DataSource来完成绑定list
------解决方案--------------------
System.Windows.Forms.BindingSource.List:只读
IList到List需要显示转换
------解决方案--------------------
引用:
我能否通过属性窗口,来关联m_List和bindingSource.DataSource呢? 似乎在编辑属性的界面上找不到能绑定m_List的地方。难道只能手写代码绑定?

嗯,这么说吧,虽然我不是很确定,但没有属性窗口可以用来绑定的可能性较大,原因是bindingSource绑定的对象多数是程序中的生成的对象,并非像dataset之类可以拖拽到界面上的对象,因此在设计视图里不会去扫描你在程序中所生成的对象,也就不会通过属性窗口让你绑定。
另外哪怕如gridview之类控件使用属性窗口绑定了dataset对象,表面上看是没在Form1.cs产生代码,但实际上只是把绑定对象的代码写在了Form1.Designer.cs,而两者的关系其实是partial class,也就是把Form1这个类的实现写在了不同文件里而已,所以你无需纠结代码绑定的问题。
------解决方案--------------------
引用:
Quote: 引用:

首先bindingSource1.List是只读属性,不能用来set,其次你要绑定需要用bindingSource1.DataSource来完成绑定list


我能否通过属性窗口,来关联m_List和bindingSource.DataSource呢? 似乎在编辑属性的界面上找不到能绑定m_List的地方。难道只能手写代码绑定?

为什么要这么干
既然数据本身写在后台,绑定的代码也写在后台不才是正常的思路么
你在后台定义个LIST,又跑回前台绑定??