I am creating a list (myEmployeeList ) as follows
myEmployeeList. Add(new Employee(12, "Anand", 25));
myEmployeeList. Add(new Employee(12, "Viral", 26));
myEmployeeList. Add(new Employee(12, "Meet", 20));
myEmployeeList. Add(new Employee(12, "Rahul", 28));
Now when i do sort with respect to ID column
myEmployeeList. Sort(Employee.I DComparison);
The resultant sorted list will be like
12 Meet 20
12 Rahul 28
12 Anand 25
12 Viral 26
Note : The list order is changing earlier it was (Anand,VIral,Me et,Rahul) now (Meet,Rahul,Ana nd,Viral)
Ideally it should not sort as the ID column is same (12) in all rows.
How can i avoide Sorting when the column data is same in all rows?
Please Respond
Thanks in Advance
myEmployeeList. Add(new Employee(12, "Anand", 25));
myEmployeeList. Add(new Employee(12, "Viral", 26));
myEmployeeList. Add(new Employee(12, "Meet", 20));
myEmployeeList. Add(new Employee(12, "Rahul", 28));
Now when i do sort with respect to ID column
myEmployeeList. Sort(Employee.I DComparison);
The resultant sorted list will be like
12 Meet 20
12 Rahul 28
12 Anand 25
12 Viral 26
Note : The list order is changing earlier it was (Anand,VIral,Me et,Rahul) now (Meet,Rahul,Ana nd,Viral)
Ideally it should not sort as the ID column is same (12) in all rows.
How can i avoide Sorting when the column data is same in all rows?
Please Respond
Thanks in Advance
Comment