c#中利用委托反射将DataTable转换为实体集的代码
类泛型的约束: 代码如下: public static class ToModel where T : class, new() 定义委托: 代码如下:public delegate void SetString(string value); 创建委托方法: 代码如下: private static SetString CreateStringDelegate(T model, string propertyName) { MethodInfo mi = model.GetType().GetProperty(propertyName).GetSetMethod(); Type t
下载地址
用户评论