NonSerialized attribute not working? (problem does not involve events)

  • Thread starter Thread starter Timo
  • Start date Start date
T

Timo

When I use XML serialization to serialize MyCustomObjectCollection, all of
the public fields of MyCustomObject are being serialized, even those I've
given the <NonSerialized()> attribute.

<Serializable()> Public Class MyCustomObject

Public FieldID As String
Public ParentId As String
Public ItemId As String

<NonSerialized()> Public Name As String
<NonSerialized()> Public Data As String
..
..
..

Both Name and Data are being serialized.
What am I missing?

Thanks
Timo
 
Timo,

XML Serialization is completely different than "normal" serialization.

In this particular case you might be able to use XMLIgnoreAttribute.

Kerry Moorman
 
Thanks, Kerry, for pointing out the differences. I had ssumed the attribute
would be the same.
Timo
 

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