I have an interface named IEmployee
. I need to implement the IComparer to the implementation of my interface.
Here is my code,
interface IEmployee
{
String Name {get;set;}
DateTime DOB {get;set;}
}
I have created a child class for this like
class Employee
{
String Name {get;set;}
DateTime DOB {get;set;}
}
Now i need to implement the IComparer to this, and in my Main
i want to get the copmarer like
IComparer<IEmployee> comparerobject= // The comparer from the class.
And using this comparer
i need to sort the collection of employee
based on their names, like
var employees = new IEmployee[]{new Employee("....."),....}
Array.Sort<IEmployee>(employees , comparer);