using System; namespace Example54 { class Employee : IComparable { private int id; private double salary; public Employee(int id, double salary) { this.id = id; this.salary = salary; } public int ID { get { return id; } set { id = value; } } public double Salary { get { return salary; } set { salary = value; } } public override string ToString() { return "Id= " + id + " salary= " + salary; } #region IComparable Members public int CompareTo(object obj) { Employee temp = (Employee) obj; if (this.salary < temp.salary) return -1; else if (this.salary == temp.salary) return 0; else return 1; } #endregion } /// /// Summary description for Class1. /// class Class1 { /// /// The main entry point for the application. /// [STAThread] static void Main(string[] args) { Employee[] emp = new Employee[] { new Employee(333, 10.50), new Employee(111, 20.50), new Employee(222, 17.55) }; Console.WriteLine("Before sorting: "); foreach (Employee e in emp) { Console.WriteLine(e); } //Sort employees in decreasing order based on salaries for(int i = 0; i