public static List<object> GData = new List<object>();
//增加值
GData.Add(new
{
Date = Convert.ToDateTime(DateField1.Text),
Name = ComboBox1.SelectedItem.Text,
NameId = ComboBox1.SelectedItem.Value,
Price = TriggerField2.Text,
Memo = TextArea1.Text
});
//获取值
for (int i = 0; i < GData.Count; i++)
{
string DateVal = GData[i].GetType().GetProperty("Date").GetValue(GData[i], null).ToString();
string NameVal = GData[i].GetType().GetProperty("Name").GetValue(GData[i], null).ToString();
string NameIDVal = GData[i].GetType().GetProperty("NameId").GetValue(GData[i], null).ToString();
string PriceVal = GData[i].GetType().GetProperty("Price").GetValue(GData[i], null).ToString();
string MemoVal = GData[i].GetType().GetProperty("Memo").GetValue(GData[i], null).ToString();
}
List<object>添加值、取值
最新推荐文章于 2024-07-12 10:01:19 发布