我有一个web服务有一个类似于下面的输入对象。我怎样才能得到这个XML结构
public class MyInput
{
[System.Xml.Serialization.XmlArrayItem("Demographic")]
public DemographicsInfo[] Demographics {get; set;}
}
随着DemographicsInfo类的定义像这样。
public class DemographicsInfo
{
[System.Xml.Serialization.XmlAttributeAttribute()]
public string Name { get; set; }
public string Value { get; set; }
}
现在,这会生成一个像这样的XML结构。
<Demographics>
<Demographic Name="String">
<value>string</value>
</Demographic>
<Demographic Name="String">
<value>string</value>
</Demographic>
</Demographics>
我需要得到它进入这个
<Demographics>
<Demographic Name="String">string</Demographic>
<Demographic Name="String">string</Demographic>
</Demographics>
对于我的生活,我似乎无法找到合适的属性(S)适用于获得这种格式。有人有建议吗?