List <List1Dto> listResult = new List <List1Dto> ();
ListResult. Add (new List1Dto {UserName = "user1", UserPwd = "user1", UserTitle = "user1", OrderNumber = "1 "});
ListResult. Add (new List1Dto {UserName = "user2", UserPwd = "user2", UserTitle = "user2", OrderNumber = "2 "});
ListResult. Add (new List1Dto {UserName = "user10", UserPwd = "user10", UserTitle = "user10", OrderNumber = "10 "});
ListResult. Add (new List1Dto {UserName = "user20", UserPwd = "user20", UserTitle = "user20", OrderNumber = "20 "});
List <List1Dto> list1 =ListResult. OrderBy (ao => ao. OrderNumber). ToList ();
String tmp = "";
Foreach (List1Dto item in list1)
{
Tmp + = item. UserName + "\ r \ n ";
}
Result:
User1
User10
User2
User20
Modify:
List <List1Dto> list1 =ListResult. OrderBy (ao => Convert. ToInt32 (string. IsNullOrEmpty (ao. OrderNumber )? "0": ao. OrderNumber). ToList ();