使用匿名类型做为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";

 
 
原文地址:https://www.cnblogs.com/meimao5211/p/3333926.html