using System.Collections.Generic;
public static void Main()
Console.WriteLine("֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎");
Console.WriteLine("֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎ SORTING LIST OF INT ֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎");
Console.WriteLine("֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎");
List<int> intList = new List<int>(){25, 34, 131, 1, 24, 68, 5, 258, -1};
Console.WriteLine("֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎ UNSORTED LIST OF INT ֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎");
foreach(int a in intList)
Console.WriteLine("\n\n֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎ SORTED LIST OF INT ֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎");
foreach(int a in intList)
Console.WriteLine("֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎ REVERSE SORTED LIST OF INT ֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎");
foreach(int a in intList)
Console.WriteLine("֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎");
Console.WriteLine("֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎ SORTING LIST OF STRING ֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎");
Console.WriteLine("֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎");
List<string> strList = new List<string>(){"Anna", "Alberto", "Pippo", "Ada", "Stefano", "Carla", "Gino"};
Console.WriteLine("֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎ UNSORTED LIST OF STRING ֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎");
foreach(string a in strList)
Console.WriteLine("\n\n֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎ SORTED LIST OF STRING ֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎");
foreach(string a in strList)
Console.WriteLine("֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎ REVERSE SORTED LIST OF STRING ֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎");
foreach(string a in strList)
Customer c1 = new Customer();
Customer c2 = new Customer();
Customer c3 = new Customer();
c1.ID = 101; c1.Name="James"; c1.Salary=2500;
c2.ID = 201; c2.Name="Tina"; c2.Salary=5500;
c3.ID = 301; c3.Name="Mark"; c3.Salary=4500;
Console.WriteLine("\n\n");
Console.WriteLine("֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎");
Console.WriteLine("֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎ SORTING LIST OF OBJECTS ֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎");
Console.WriteLine("֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎֎");
List<Customer> listCust = new List<Customer>(){c1, c2, c3};
foreach(Customer c in listCust)
Console.WriteLine("Customer ID {0},\t\tName is {1},\t\tsalary is {2}", c.ID.ToString(), c.Name, c.Salary.ToString());
public class Customer : IComparable<Customer>
public int ID {get; set;}
public string Name {get; set;}
public int Salary {get; set;}
public int CompareTo(Customer obj) { return this.Salary.CompareTo(obj.Salary); }