IComparer is an interface provided by the .NET framework, used in conjunction with the Array.Sort and Array.BinarySearch methods. It provides a way to customize the sort order of a collection. It contains a single Compare method that compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other. There is also a generic version of this interface. Supported in .NET 4, 3.5, 3.0, 2.0, 1.1, 1.0. Source: MSDN
Questions tagged [icomparer]
228 questions
-3
votes
2 answers
How to measure how long IComparer took?
Hi I'm currently writing a testing plan for part of my project and I would like to know how to measure how long my sort function takes. My attempt looked like this:
private void byIGNameToolStripMenuItem_Click(object sender, EventArgs e)
{
…

Szymon Zmudzki
- 41
- 1
- 5
-4
votes
2 answers
Generic list manager. Cant access Comparer interface in Sort method with object that inludes comparer method
I have a generic list manager class ListManager which I use to store Animal objects in the AnimalManager subclass to the list manager.
In the Animal class I have added the IComparer interface and added a Compare method.
For some reason i get an…

Nungwe
- 29
- 6
-4
votes
4 answers
LINQ custom sort using comparer
I have a class:
public class Item
{
public int ownerID;
public decimal value;
}
And an array of objects
Item[] items;
That looks like:
ownerID value
476478 0.65
636566 0.2
And I have a second class
public class Owner
{
public…

Ilan
- 989
- 2
- 12
- 22