Sort List Of Class using Id property?
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();
精彩评论