Friday, 16 March 2012

Sorting a List of Objects on a particular field.

   public static List<Participant> SortedObjects(IEnumerable<Participant> myList) {
     SortedList<string,Participant> sortedList = new SortedListstringParticipant>();
     foreach (Participant participant in myList) {
         sortedList.Add(participant.RegistrationNo, participant);
     }
     return new List<Participant>(sortedList.Values);
  }

No comments:

Post a Comment