Serialize Property jako atrybut Xml w Element
Mam następującą klasę:
[Serializable]
public class SomeModel
{
[XmlElement("SomeStringElementName")]
public string SomeString { get; set; }
[XmlElement("SomeInfoElementName")]
public int SomeInfo { get; set; }
}
Który (wypełniony pewnymi danymi testowymi) i Serializowany za pomocą XmlSerializer.Serialize () daje następujący XML:
<SomeModel>
<SomeStringElementName>testData</SomeStringElementName>
<SomeInfoElementName>5</SomeInfoElementName>
</SomeModel>
Muszę mieć:
<SomeModel>
<SomeStringElementName Value="testData" />
<SomeInfoElementName Value="5" />
</SomeModel>
Czy istnieje sposób na określenie tego jako atrybutów bez pisania własnego niestandardowego kodu serializacji?