开发者

Sort List Of Class using Id property?

开发者 https://www.devze.com 2023-01-19 19:52 出处:网络
I have a class called Questions. This Questions has properties QuestionID and QuestionAnswer. My list of Questions has 开发者_如何学编程QuestionID like 2,3,4,15,12,24,22,,,, etc

I have a class called Questions. This Questions has properties QuestionID and QuestionAnswer. My list of Questions has 开发者_如何学编程QuestionID like 2,3,4,15,12,24,22,,,, etc

I need to sort this List of Questions Object based on QuestionID and store in another Questions object.


There is a framework called LINQ designed for this exact sort of task. For example, in C#:

var sortedList = questionList.OrderBy(q => q.QuestionID).ToList();
0

精彩评论

暂无评论...
验证码 换一张
取 消