Created
April 29, 2009 21:02
-
-
Save tncbbthositg/104052 to your computer and use it in GitHub Desktop.
This file contains 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
public class ComparerProxy<T> : IComparer<T> | |
{ | |
private readonly IComparer<T>[] _comparers; | |
public ComparerProxy(params IComparer<T>[] comparers) | |
{ | |
_comparers = comparers; | |
} | |
public int Compare(T x, T y) | |
{ | |
int retVal = 0, i = 0; | |
while (retVal == 0 && i < _comparers.Length) | |
retVal = _comparers[i++].Compare(x, y); | |
return retVal; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment