类泛型的约束: 代码如下: public static class ToModel<T> 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