1

I am trying to serialize an object using XmlSerializer. The input class that has a property with [XmlAttribute] is not showing up in output xml. Anyway to fix this?

2
  • can you please post your code! Commented Sep 30, 2013 at 9:31
  • Can we see the class please? Context is everything. Commented Sep 30, 2013 at 9:35

1 Answer 1

1

For it not to appear at all, one of these things is usually true:

  • the type is not appropriately accessible; for typical values, this means that it needs a public getter and setter; if it lacks both: it will not be serialized (note that for collections, only a getter is required)
  • conditional serialization of some form is enabled (either via [DefaultValue], or a ShouldSerialize*() method), and is indicating to omit it
  • it is being fully ignored ([XmlIgnore], for example)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.