Why when using a sort method on a list of objects do you need to have a Icomparable method in the corresponding class?
List<students> studentList = new List<Student>();
//add objects to list.
studentList.Sort();
When sorting an array for example this is not required?
sort() method for list of objects?
Started by phil333, May 28 2010 04:34 AM
2 replies to this topic
#1
Posted 28 May 2010 - 04:34 AM
|
|
|
#2
Posted 28 May 2010 - 05:01 AM
Lists are more elegant than arrays. They can do stuff for you, instead arrays need you to do the stuff yourself. Use lists if you find them better.
Are you a newbie programmer trying to learn C#? Check out my small tutorial: Visual C# Programming Basics
#3
Posted 29 May 2010 - 12:05 AM
list of object i think can be a strongly type and you the icomperable interface to determine which is lesser, if you understand why you have to overload operators this will make more sense


Sign In
Create Account

Back to top









