Skip to content

Instantly share code, notes, and snippets.

@tncbbthositg
Created April 29, 2009 21:02
Show Gist options
  • Save tncbbthositg/104052 to your computer and use it in GitHub Desktop.
Save tncbbthositg/104052 to your computer and use it in GitHub Desktop.
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