elemtns的排序顺序 [英] Sorting order of the elemtns

查看:135
本文介绍了elemtns的排序顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



如果你能解决我的问题,我将非常感激。



我面临的问题是关于特殊字符,数字和Alphbets的排序顺序。



我认为默认排序是特殊字符 - >数字 - > Alphbets按升序排列。假设我有以下数据



Test1,12234,23,@ abc,@ 123 



如果我们按升序对c#中的上述数据进行排序,那么我们将得到以下结果



< pre lang =text>@ 123,@ abc,12234,23,test1





但根据我的要求,我希望排序为数字 - >特殊字符 - >字母



以上结果应为



12234,23,@ 123,@ abc,test1









这些结果我在DataGrid中显示,所以我想改变网格的默认排序方式,以便实现上述结果。







提前致谢。

解决方案

使用链接OrderBy方法 - 它允许您自己指定字符串的排序顺序: http://msdn.microsoft。 com / en-us / library / bb549422.aspx [ ^ ]

Hi All,

I will be highly obliged if you could solve my issue.

The issue which I am facing that is about the sorting order of the Special Chars, Numbers and Alphbets.

I think default sorting is Special Chars -> Numbers -> Alphbets in Ascending order. Suppose I have below data

"Test1","12234","23","@abc","@123"


if we sort the above data in c# in ascending order then we will get the following result

"@123","@abc","12234","23","test1"



But as per my requirement , I want the sorting to be Numbers -> Special Chars ->Alphabets

The above result should come as

"12234","23","@123","@abc","test1"





And these results I am displaying in the DataGrid, So I want to change the way of default sorting of the grid so that the above result can be achieved.



Thanks in advance.

解决方案

Use the Link OrderBy method - it allows you to specify the sort order for the strings yourself: http://msdn.microsoft.com/en-us/library/bb549422.aspx[^]


这篇关于elemtns的排序顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆