help - serilization

  • Thread starter Thread starter mortb
  • Start date Start date
M

mortb

I have a class that I want to serialize to into the viewstate of an aspx
form.
I've specified the [Serializable] attribute on top of the class definition,
compiled but when I browse the page I get an excepiton that the class must
be marked as Serializable.
Can this have something to do with some of the members not beeing of
serializable types? I thought it would be neat to put my custom object in
the viewstate. How do I solve this?
Does anyone have a link that provides me with some in depth information
about this?

cheers,
mortb
 
mortb,

That's exactly what it is. When you mark your class as serializable,
every field must be marked as serializable as well. If you want to indicate
that certain members of your class should not be serializable, then you can
adorn them with the NonSerialized attribute.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top