exist easy solution how this (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();
}
make in Java Spring (without .NET)? I wanna sort list of object by dynamic name property...
Thank you very much for any advice...
Aucun commentaire:
Enregistrer un commentaire