//获取类【OflSchApplyVM】的所有属性
                    PropertyInfo[] _PropertyInfo = typeof(OflSchApplyVM).GetProperties();

                    //对应属性
                    PropertyInfo _pro = null;

                    //获取属性名=【sort】的属性
                    foreach (var item in _PropertyInfo)
                    {
                        if (item.Name == sort)
                        {
                            _pro = item;
                        }
                    }

                    //List<T>排序
                    if (_pro != null)
                    {

                        if (order == "desc")
                        {

                            lstPage = lstPage.OrderByDescending(a => _pro).ToList();
                        }
                        if (order == "asc")
                        {
                            lstPage = lstPage.OrderBy(a => _pro).ToList();
                        }

                    }

  

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-27
  • 2022-12-23
  • 2022-02-14
  • 2022-01-12
  • 2021-07-01
  • 2021-06-19
猜你喜欢
  • 2021-06-06
  • 2022-12-23
  • 2021-12-14
  • 2021-07-21
  • 2022-12-23
  • 2022-12-23
  • 2021-09-21
相关资源
相似解决方案