1
DataTable table = new DataTable();2
table.Columns.Add("ID", typeof(string));3
table.Columns.Add("Name", typeof(string));4

5
DataRow row = table.NewRow();6

7
row["ID"] = "All";8
row["Name"] = "全部";9
table.Rows.Add(row);10
row = table.NewRow();11
row["ID"] = "Add";12
row["Name"] = "添加";13
table.Rows.Add(row);14
row = table.NewRow();15
row["ID"] = "Update";16
row["Name"] = "修改";17
table.Rows.Add(row);18
row = table.NewRow();19
row["ID"] = "Delete";20
row["Name"] = "删除";21
table.Rows.Add(row);
//Dictionary 的用法
Dictionary<string, int> dic = new Dictionary<string, int>();
private int GetLevel(string id)
{
int num = 0;
foreach(KeyValuePair<string, int> d in dic)
{
if (d.Key.ToString() == id) {
num =Convert.ToInt32(d.Value);
}
}
return num;
}
浙公网安备 33010602011771号