Lost values with XML Deserializion

Posted by iTayb on Stack Overflow See other posts from Stack Overflow or by iTayb
Published on 2010-03-21T20:48:25Z Indexed on 2010/03/21 20:51 UTC
Read the original article Hit count: 398

Filed under:
|

Here is my class BookStore: http://pastebin.com/dnQkDUWk

The class can be load and save XML files. For some reason, I have a problem regarding Rating value that gets lost when I load from XML (using void LoadFromXML(string path) method.

The following code prints 0 although actual value is 5:

BookStore b = new BookStore();
b.LoadFromXML(Server.MapPath("list.xml"));
Label1.Text = b.BooksList[0].Rating.ToString();

Please note: only the specific Rating parameter is lost. I can't figure what went wrong. Thank you very much!

© Stack Overflow or respective owner

Related posts about c#

Related posts about xml-serialization