このXML構造でマップするクラスを作成しようとしていますが、その方法がわかりません。ここで、要素値が文字列の場合に[XmlText]を使用できる例を見てきました。私の場合、要素値はブール値です。「サービス」クラスはどのように作成すればよいですか?
(私は思う)「サービス」要素の世話をする方法を知っている:-)。これは単なる「サービス」オブジェクトの配列です。「Service」クラスの作成方法がわかりません。
<?xml version="1.0" encoding="utf-8"?>
<Config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MyConfigs>
<Services>
<Service Name="ServiceName">true</Service>
</Services>
</MyConfigs>
私はこれを持っています:
[XmlArray("Services")]
[XmlArrayItem("Service")]
public Service[] Services { get; set; }
この:
public class Service
{
[XmlAttribute]
public string Name { get; set; }
// How do I get the boolean value here?????
}