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

相关文章:

  • 2022-01-19
  • 2021-11-17
  • 2021-12-31
  • 2021-05-15
  • 2021-11-13
  • 2021-05-18
  • 2022-01-14
  • 2021-12-22
猜你喜欢
  • 2021-09-14
  • 2022-12-23
  • 2021-06-01
  • 2022-02-09
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
相关资源
相似解决方案