【发布时间】:2020-08-02 06:12:18
【问题描述】:
如何存在简单的解决方案(C# .NET):
private void sortData(string param, string type)
{
var propertyInfo = typeof(MusicCatalogueRowClass).GetProperty(param);
if (type == "asc")
{
_Data.rows = _Data.rows.OrderBy(o => propertyInfo.GetValue(o, null)).ToList();
}
else {
_Data.rows = _Data.rows.OrderByDescending(o => propertyInfo.GetValue(o, null)).ToList();
}
saveDataToFile();
}
在 Java Spring 中制作(没有 .NET)?我想按动态名称属性对对象列表进行排序...
非常感谢您的任何建议...
【问题讨论】:
标签: java spring-mvc dynamic reflection properties