-1
をクリーンアップすることができますは、どのように私は、このクラスのオブジェクト直列化した後、私のXMLコード
[XmlType("Person")] // define Type
public class Person
{
[XmlElement("PropertyType")]
public PropertyType PropertyType { get; set; }
[XmlElement("ID")]
public string ID { get; set; }
[XmlElement("Name")]
public string Name { get; set; }
[XmlElement("City")]
public string City { get; set; }
[XmlElement("Age")]
public Dictionary<object, object> Age { get; set; }
}
私はこのコードを持っている:
<PersonenListe>
<PersonenArray>
<PersonObjekt>
<PropertyType>Unknown</PropertyType>
<ID>0</ID>
<FriendlyName>Max Man</FriendlyName>
<City>Capitol City</City>
<Age>33</Age>
<Name>
<item>
<key>
<anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" p8:type="q1:string" xmlns:p8="http://www.w3.org/2001/XMLSchema-instance">test1</anyType>
</key>
<value>
<anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" p8:type="q1:string" xmlns:p8="http://www.w3.org/2001/XMLSchema-instance">test2</anyType>
</value>
</item>
</Name>
</PersonObjekt>
</PersonenArray>
</PersonenListe>
How can I clean up it(I want to have code without this namespaces)? maybe using some attributes?
Update:
when I serialize it separetly I get:
<PersonenListe>
<PersonenArray>
<PersonObjekt>
<PropertyType>Unknown</PropertyType>
<ID>0</ID>
<FriendlyName>Max Man</FriendlyName>
<City>Capitol City</City>
<Age>33</Age>
<Name />
</PersonObjekt>
</PersonenArray>
</PersonenListe>
<?xml version="1.0"?>
<dictionary>
<item>
<key>
<string>test1</string>
</key>
<value>
<string>test2</string>
</value>
</item>
</dictionary>
ないあなたが探しているものを確認しますが。 XmlAttributeを使用することを意味しますか? – Default
名前空間を削除した場合、シリアライザは弱い型指定の構造体にどの型を 'Dictionary
何を使うべきかは重要ではなく、主なものはコードをクリーンアップすることです) – revolutionkpi