Community discussion forum

Customize XML Serialization using IXmlSerializable

This is a comment thread discussing Customize XML Serialization using IXmlSerializable
  • 9 years ago

    This thread is for discussions of Customize XML Serialization using IXmlSerializable.

  • Advertisement

    Simply the fastest line-level profiler for .NET ever

    “The low overhead means it has minimal impact on the execution of my program”
    Mark Everest, Development Team Leader, Renault F1 Team Ltd.

    Try out the new ANTS Profiler 4 for yourself. Download your 14-day trial now

  • 2 years ago

    I've been looking for some example like this for a while now, it's great.


    But I have a question about some error I got.


    Using the normal serialization (without overriding the IXmlSerializable interface functions) you are able to add attributes to fields, for example:


    <XmlElement("DESCRIPTION")> _
    Public Desc As String


    And that works fine.  It checks the attribute and when it exports the class to XML, Desc is written as DESCRIPTION.


    After I implement IXmlSerializable , I get a  run time error saying I can't have attributes on members.  Why is that?


    Also, I did not include the [Serializable] attribute for my class, and it still worked for me.  What is the purpose of [Serializable] attribute?


    Thanks for any input

Post a reply

Enter your message below

Sign in or Join us (it's free).