Beispiel #1
0
        static void Main(string[] args)
        {
            try
            {
                BookInLibrary x1 = new BookInLibrary("Игра престолов", 1996, 569);
                BookInLibrary x2 = new BookInLibrary("Битва королей", 1998, 600);
                BookInLibrary x3 = new BookInLibrary("Буря мечей", 2000, 541);
                BookInLibrary x4 = new BookInLibrary("Лисенко", "Методические указания", 9485, 2019, 10, "информация");
                BookInLibrary x5 = new BookInLibrary("Даниель Дефо", "Робинзон Крузо", 9343, 1985, 300, "приключенческий роман");
                BookInLibrary x6 = new BookInLibrary();

                BookInLibrary[] books = new BookInLibrary[] { x1, x2, x3, x4, x5, x6 };

                books[5].getInfo(5);
                for (int i = 0; i < books.Length; i++)
                {
                    books[i].ToString();
                }

                Search(books);
                Console.WriteLine("\n\n");
                CompareAuthor(books);
                Console.WriteLine("\n\n");
                ComparePages(books);
            }
            catch (IndexOutOfRangeException)
            {
                Console.WriteLine("Список книг пуст");
            }
        }
Beispiel #2
0
        public int CompareTo(object o)
        {
            BookInLibrary one = (BookInLibrary)o;

            return(year.CompareTo(one.year));
        }