LinkedList cannot be serialised?

Posted by iTayb on Stack Overflow See other posts from Stack Overflow or by iTayb
Published on 2010-03-20T13:55:03Z Indexed on 2010/03/20 14:01 UTC
Read the original article Hit count: 441

Filed under:
|

Here are my classes: http://pastebin.com/3dc5Vb1t

When I try to run

BookStore b = new BookStore();
b.LoadFromXML(Server.MapPath("list.xml"));
Label1.Text = b.ToString();

I get the following error:

You must implement a default accessor on System.Collections.Generic.LinkedList`1[[Book, App_Code.cxsacizw, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]] because it inherits from ICollection.

The error source is XmlSerializer s = new XmlSerializer(typeof(BookStore));

When I tried to look for a solution on google, I found it that LinkedList has some problems with serialization. How can I deal with it?

Thank you very much.

© Stack Overflow or respective owner

Related posts about c#

Related posts about xml-serialization