使用匿名类型做为ComboBox的DataSource

使用匿名类型做为ComboBox的DataSource

 

            ArrayList list = new ArrayList();
            list.Add(new { id = "0", value = "--请选择--" });
            list.Add(new { id = "1", value = "一般案件" });
            list.Add(new { id = "2", value = "银行案件" });
            this.cboSource.DataSource = list;
            this.cboSource.ValueMember = "id";
            this.cboSource.DisplayMember = "value";

 
 
分类: C#
标签: 匿名DataSourceC#
posted @ 2013-09-22 21:47  meimao5211  阅读(261)  评论(0编辑  收藏  举报