1.反射创建类型

          //3 列排序
                Type t = data.ElementType;
                //var pcs = Activator.CreateInstance(t, new object[] {
                //    "addTime",
                //    Common.ListSortDirection.Ascending
                //});

                Type type = typeof(PropertySortCondition<>);
                type = type.MakeGenericType(t);
                var pcs = Activator.CreateInstance(type, new object[] {
                    "addTime",
                    Common.ListSortDirection.Ascending
                });
View Code

相关文章: