1

What should be the class structure such that it serializes in the format given below

 <Header>
          <Version environment="debug">2.2</Version>
 </Header>
[XmlRoot]
public class Header
{
   [XmlElement]
   public string Version{get;set;}
}

1 Answer 1

0
[XmlRoot]
public class Header
{
    [XmlElement]
    public Version Version { get; set; }
}

public class Version
{
    [XmlAttribute("environment")]
    public String Environment { get; set; }

    [XmlText]
    public String Value { get; set; }
}
Sign up to request clarification or add additional context in comments.

1 Comment

Oh..i was just not able to find this..Thank you :)

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.