1 Person p = new Person();
2 p.Id = 1;
3 p.Name = "张三";
4 p.Sex = "男";
5 p.Weight = 65;
6 p.Height = 180;
7 p.Birthday = DateTime.Now;
8
9 List<Person> pList = new List<Person>();
10 pList.Add(p);
11
12 List<Dictionary<string, object>> rows = new List<Dictionary<string, object>>();
13 foreach (var Entity in pList)
14 {
15 Dictionary<string, object> row = new Dictionary<string, object>();
16 foreach (PropertyInfo item in Entity.GetType().GetProperties())
17 {
18 row.Add(item.Name, item.GetValue(Entity, null));
19 }
20 rows.Add(row);
21 }
22
23 var RealRows = rows.ToList();