public static ParamCache GetParamCache(string name, DataTable data, string colname) { ParamCache pc = new ParamCache(); pc.Name = name; string itemname = String.Empty; string itemvalue = String.Empty; if (!String.IsNullOrEmpty(colname)) { string[] splits = colname.Split(','); if (splits.Length == 2) { itemname = splits[0]; itemvalue = splits[1]; } } string rname = String.Empty; string rvalue = String.Empty; foreach (DataRow row in data.Rows) { if (!String.IsNullOrEmpty(itemname)) { rname = row[itemname].ToString(); } else { rname = row[1].ToString(); } if (!String.IsNullOrEmpty(itemvalue)) { rvalue = row[itemvalue].ToString(); } else { rvalue = row[0].ToString(); } pc.Items.Add(new ComboBoxItem(rname, rvalue)); } return(pc); }
public void Add(ParamCache item) { base.List.Add(item); }