Getting three errors, all same on different items. RetrieveBookList, RetrieveBook, StoreBookList. It appears as though it is ok for StoreBook though. Not real sure what I am missing. 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();
-
}
-
-
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;
-
}
-
1 1673
You must implement IBookService interface: - 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 void 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 void StoreBookList(Book[] bookx)
-
{
-
//Implementation
-
}
-
-
public Book[] RetrieveBookList(int maxcount)
-
{
-
//implementation
-
}
-
}
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Armin Zingler |
last post by:
Hi group,
how can I have a base class member implement an interface member?
Example:
class a
sub Member1
end sub
end class
|
by: Ben Voigt [C++ MVP] |
last post by:
I get
C:\Programming\LTM\devtools\UselessJunkForDissassembly\Class1.cs(360,27):
error CS0535: 'UselessJunkForDissassembly.InvocableInternals' does not
implement interface member...
|
by: =?Utf-8?B?Sm9uIEU=?= |
last post by:
I have an interface class with maybe eight functions, defined in one
workspace and am defining a class in a second workspace that derives from
this interface.
Unfortunately only 7 of the 8...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |