예제 #1
0
파일: TheBook.cs 프로젝트: darkarki83/.NET
        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");
        }
예제 #2
0
 static public void SortByFhone(PhoneBook book)
 {
     ListSort.Sort(book, (client1, client2)
                   => client1.foneNumber > client2.foneNumber);
 }
예제 #3
0
 static public void SortByadress(PhoneBook book)
 {
     ListSort.Sort(book, (client1, client2) => string.Compare(client1.adress, client2.adress) < 0);
 }
예제 #4
0
 static public void SortByLastName(PhoneBook book)
 {
     ListSort.Sort(book, (client1, client2) => string.Compare(client1.lastName, client2.lastName) < 0);
 }