I am having difficulties to use my custom IComparer for my SortedDictionary<>. The goal is to put email addresses in a specific format (firstnam.lastname@domain.com) as t
If the 2 lastNames are equal then compare for example the whole email like:
int comp = xLastname.CompareTo(yLastname);
if (comp == 0)
return x.CompareTo(y);
return comp;
Actually, sorteddictionary comparison is also used to distinguish amongst keys* , so you must specify a complete comparison (not only your sorting strategy)
EDIT: * I mean in sortedDictionary 2 keys are equal if Comparer gives 0