List<Test> t = new List<Test>(); // 将Person对象放入集合 t.Add(new Test { id= "201052", price = 5555, }); t.Add(new Test { password = "22", }); t.Add(new Test { password = "11311", createTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")), price = 99 });
List<Person> listProduct = new List<Person> { new Person{Name="1",Sex="01",Age="a",quty=20}, new Person{Name="2",Sex="01",Age="b",quty=20}, new Person{Name="3",Sex="02",Age="c",quty=20}, new Person{Name="4",Sex="02",Age="d",quty=10}, new Person{Name="5",Sex="03",Age="e",quty=50}, };