Created
July 26, 2013 10:43
-
-
Save hatelove/6087948 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal class CompoundComparer<T> : IComparer<T> | |
{ | |
private readonly IComparer<T> primary; | |
private readonly IComparer<T> secondary; | |
internal CompoundComparer(IComparer<T> primary, | |
IComparer<T> secondary) | |
{ | |
this.primary = primary; | |
this.secondary = secondary; | |
} | |
public int Compare(T x, T y) | |
{ | |
int primaryResult = primary.Compare(x, y); | |
if (primaryResult != 0) | |
{ | |
return primaryResult; | |
} | |
return secondary.Compare(x, y); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment