List .Orderby 无法排序???
MyClass tmpClass = new MyClass();
List<MyClass> tmpList = new List<MyClass>();
tmpClass.MyID = "5";
tmpClass.RandomCode = "555";
tmpList.Add(tmpClass);
tmpClass = new MyClass();
tmpClass.MyID = "3";
tmpClass.RandomCode = "333";
tmpList.Add(tmpClass);
tmpClass = new MyClass();
tmpClass.MyID = "1";
tmpClass.RandomCode = "111";
tmpList.Add(tmpClass);
tmpClass = new MyClass();
tmpClass.MyID = "4";
tmpClass.RandomCode = "444";
tmpList.Add(tmpClass);
tmpClass = new MyClass();
tmpClass.MyID = "2";
tmpClass.RandomCode = "222";
tmpList.Add(tmpClass);
tmpList.OrderBy(p => p.MyID).ToList();
查看结果,排序还是 5 3 1 4 2 ?
我想把里面的 排序成 12345 请问不能排序是什么原因