Order List<Object> by property name
This question already has an answer here:
you would need to calculate a key to sort by
List<Test> ordered = values.OrderBy(v =>
v.Value.StartsWith(">") ? "ZZ" + v.Value : v.Value
).ToList();
"ZZ" is an arbitrary key that will sort the values starting with ">" after all English terms. (Being the last letter in the alphabet and no English words starting with two Zs). SInce ">" has a lower byte value than any letter one Z
is not enough, since any valid english term would sort after anything staring with Z>
上一篇: 我如何按姓氏排序?
下一篇: 按属性名称排序列表<对象>