Hi. I am using a comparer class to sort a list of People details by their firstName.
The code to do this is as follows:
public class PersonDetailsComparer : IComparer<PersonDetails>
{
public int Compare(PersonDetails x, PersonDetails y)
{
int returnValue = 0;
if (x != null && y != null && x. FirstName != null && y. FirstName != null)
{
return x.FirstName.CompareTo(y.FirstName );
}
return returnValue;
}
}
This is working fine, that is the list is sorted in ascending order. But now, I need to add some exceptions, for example I want the following names to appear first from the list:
Lever
Johnson
Zaher
and then sorting the remaining list in ascending order.
Can any one please help me.
Thanks