当前位置: 首页>>代码示例>>C#>>正文


C# Library.RemoveBook方法代码示例

本文整理汇总了C#中Library.RemoveBook方法的典型用法代码示例。如果您正苦于以下问题:C# Library.RemoveBook方法的具体用法?C# Library.RemoveBook怎么用?C# Library.RemoveBook使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Library的用法示例。


在下文中一共展示了Library.RemoveBook方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main(string[] args)
        {
            Library library = new Library();
            library.CollectionChanged += library.book_collChanged;
            Student firstStudent = new Student("Saveliy","Prokopenko",23);
            Student secondStudent = new Student("Pavlo","Tarasenko",23);
            library.addBook += firstStudent.NewBookComputerLiterature;
            library.addBook += secondStudent.NewBookFantastik;
            library.removeBook += secondStudent.RemovedBookFromLibrary;
            Book book1 = new Book("BookName1", "AuthorName1", "Fantastic");
            library.AddBook(book1);
            Book book2 = new Book("BookName2", "AuthorName2", "ComputerLiterature");
            library.AddBook(book2);
            library.AddBook(book2);
            library.AddBook(book2);
            library.RemoveBook(book2);


        }
开发者ID:kyzya30,项目名称:HW_Collections_28.08.15,代码行数:19,代码来源:Program.cs

示例2: Main

    static void Main()
    {
        Console.WriteLine("Enter name of the library");
        string name = Console.ReadLine();
        List<Book> bookList = new List<Book>();
        Library library = new Library(name, bookList);
        Console.WriteLine("Enter number of books");
        int number = int.Parse(Console.ReadLine());
        for (int count = 0; count < number; count++)
        {
            Book book = Book.CreateBook();
            library.AddBook(book);
            Console.WriteLine();
        }

        for (int count = 0; count < bookList.Count; count++)
        {
            Book book = library.BookList[count];
            library.PrintBook(book);
            Console.WriteLine();
        }

        List<Book> stevenKing = library.FindBook("Steven King");
        Console.WriteLine("Steven King Books");
        for (int count = 0; count < stevenKing.Count; count++)
        {
            Book currentBook = stevenKing[count];
            library.PrintBook(currentBook);
            library.RemoveBook(currentBook);
        }

        Console.WriteLine();
        Console.WriteLine("Library after removing books");
        for (int count = 0; count < library.BookList.Count; count++)
        {
            Book book = library.BookList[count];
            library.PrintBook(book);
            Console.WriteLine();
        }
    }
开发者ID:vasilkrvasilev,项目名称:ObjectOrientedProgramming,代码行数:40,代码来源:CreateLibrary.cs


注:本文中的Library.RemoveBook方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。