Exemplo n.º 1
0
        public void SortClient(object sender, ChoiceEventArgs e)
        {
            ConsoleKey keyBefor;

            ListSort.SortMenu(out keyBefor);
            switch (keyBefor)
            {
            case ConsoleKey.D1:
            case ConsoleKey.NumPad1:
                ListSort.SortByName(one);
                break;

            case ConsoleKey.D2:
            case ConsoleKey.NumPad2:
                ListSort.SortByLastName(one);
                break;

            case ConsoleKey.D3:
            case ConsoleKey.NumPad3:
                ListSort.SortByFhone(one);
                break;

            case ConsoleKey.D4:
            case ConsoleKey.NumPad4:
                ListSort.SortByadress(one);
                break;
            }
            Console.WriteLine("Sort Is done");
        }
Exemplo n.º 2
0
 static public void SortByFhone(PhoneBook book)
 {
     ListSort.Sort(book, (client1, client2)
                   => client1.foneNumber > client2.foneNumber);
 }
Exemplo n.º 3
0
 static public void SortByadress(PhoneBook book)
 {
     ListSort.Sort(book, (client1, client2) => string.Compare(client1.adress, client2.adress) < 0);
 }
Exemplo n.º 4
0
 static public void SortByLastName(PhoneBook book)
 {
     ListSort.Sort(book, (client1, client2) => string.Compare(client1.lastName, client2.lastName) < 0);
 }