摘要: 问题:将SqlDataReader对象转换为List集合思路:1,利用反射的特性得到对应实体Model的公共属性 Type type = typeof(T); PropertyInfo[] p = type.GetProperties(); 这样就得到了该实体Model中的属性 2,利用反射创建该类的实例var model = Activator.CreateInstance(); 3,遍历该实体中的所有属性,将该实例插入到集合中 整体代码如下: 1 using System; 2 using System.Collections.Generic; 3 using S... 阅读全文
posted @ 2013-12-05 10:15 苏镡 阅读(640) 评论(0) 推荐(1) 编辑