1. 首页
  2. 数据库
  3. 其它
  4. c#中利用委托反射将DataTable转换为实体集的代码

c#中利用委托反射将DataTable转换为实体集的代码

上传者: 2021-01-04 02:41:07上传 PDF文件 45.02KB 热度 11次
类泛型的约束: 代码如下: 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
下载地址
用户评论