tags:

views:

37

answers:

2

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.

+1  A: 

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();
Ian Henry
A: 

You can use Linq. Like so.

var sortedQs = Questions.Sort(q => q.QuestionID).ToList();
EJC