I am getting this error on RetrieveBookList, RetrieveBook and StoreBookList, although it works on StoreBook. I think there is an issue with my generic list because when i just called one book, I didn't recieve this error. Cannot figure out where I went wrong though. Any help would be appreciated.....

public class BookSvcBinImpl : IBookService
    {
        public void StoreBook(Book bookx)
        {
            IList<Book> listBooks = new IList<Book>();
            FileStream saveStream = new FileStream("Book.bin", FileMode.Create, FileAccess.Write);
            IFormatter formatter = new BinaryFormatter();
            formatter.Serialize(saveStream, bookx);
            saveStream.Close();
        }

        public Book RetrieveBook()
        {
            FileStream loadStream = new FileStream("Book.bin", FileMode.Open, FileAccess.Read);
            //IFormatter formatter = new BinaryFormatter();
            IList<Book> listBooks = formatter.Deserialize(loadStream) as IList<Book>;
            //Book bookX = formatter.Deserialize(loadStream) as Book;
            loadStream.Close();
            //return bookX;
        }
    }
public interface IBookService : IService
    {
        void StoreBook(Book bookx);
        void StoreBookList(Book[] bookx);
        void RetrieveBook(Book bookx);
        Book[] RetrieveBookList(int maxcount);
        //Book RetrieveBook();
    }
private void SubmitBtn_Click(object sender, EventArgs e)
        {
            this.AcceptButton = AddSubmitBtn;                  // Enables button when enter is pushed

            IList<Book> listBooks = new IList<Book>();
            Book book = new Book();

            book.isbn = AddISBNTxt.Text;
            book.status = AddStatusTxt.Text;
            book.title = AddTitleTxt.Text;
            book.series = AddSeriesTxt.Text;
            book.author = AddAuthorTxt.Text;
            book.description = AddDescTxt.Text;
            //book.addition = ConfirmBox.

            BookMgr bookMgr = new BookMgr();
            bookMgr.CreateBook(book);

            MessageBox.Show("Book has been added!");
        }

Where's the Book class? Where's the RetrieveBookList method? What line is giving you the error in all that code?

{
    [Serializable]
    public class Book
    {
        private string ISBN;                     // ISBN of the book.
        private string Status;                   // Status of the book.
        private string Title;                    // Title of the book.
        private string Series;                   // Series of the book.
        private string Author;                   // Author of the book.
        private string Description;              // Description of the book.   
        //private bool Addition;                   // Addition of book.

        private Book() { }
        public Book(string isbn, string status, string title, string series, string author, string description)
        {
            ISBN = isbn;
            Status = status;
            Title = title;
            Series = series;
            Author = author;
            Description = description;
            //Addition = addition;
        }

        public string isbn
        {
            get { return ISBN; }
            set { ISBN = value; }
        }

        public string status
        {
            get { return Status; }
            set { Status = value; }
        }

        public string title
        {
            get { return Title; }
            set { Title = value; }
        }

        public string series
        {
            get { return Series; }
            set { Series = value; }
        }

        public string author
        {
            get { return Author; }
            set { Author = value; }
        }

        public string description
        {
            get { return Description; }
            set { Description = value; }
        }

        //public bool addition
        //{
        //    get { return Addition; }
        //    set { Addition = value; }
        //}

        public bool ValidateBook()
        {
            if (status == null)
                return false;
            if (title == null)
                return false;
            return true;
        }

        override public bool Equals(Object o)
        {
            if (!(o is Book)) return false;
            Book book = (Book)o;
            if (!book.ISBN.Equals(ISBN)) return false;
            //if (!book.Status.Equals(Status)) return false;
            //if (!book.Title.Equals(Title)) return false;
            //if (!book.Series.Equals(Series)) return false;
            //if (!book.Author.Equals(Author)) return false;
            //if (!book.Description.Equals(Description)) return false;
            //if (!book.Addition.Equals(Addition)) return false;
            return true;
        }
    }
public class BookMgr : Manager
    {
        public void CreateBook(Book book)
        {
            Factory factory = new Factory();
            IBookService bookSvc = (IBookService)GetService(typeof(IBookService).Name);
            bookSvc.StoreBook(book);
        }

        public void FindBook(Book isbn) 
        {
            Factory factory = new Factory();
            IBookService bookSvc = (IBookService)GetService(typeof(IBookService).Name);
            bookSvc.RetrieveBook();
        }

Was able to figure this out. Now just have to deal with the other 7 errors figuring it out brought on.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.