私は次のC#クラスプロパティを持っています:
private List<string> _accountTypes;
[XmlArray(ElementName = "accountTypes")]
public List<string> AccountTypes
{
get { return _accountTypes; }
set { _accountTypes = value; }
}
これは、クラスコンストラクタで次のように初期化されます。
_accountTypes = new List<string>( new string[] { "OHGEE", "OHMY", "GOLLY", "GOLLYGEE" });
デシリアライズすると、次のようになります。
<accountTypes>
<string>OHGEE</string>
<string>OHMY</string>
<string>GOLLY</string>
<string>GOLLYGEE</string>
</accountTypes>
私がこれを手に入れることができれば私はそれが好きなはずです:
<accountTypes>
<accountType>OHGEE</accountType>
<accountType>OHMY</accountType>
<accountType>GOLLY</accountType>
<accountType>GOLLYGEE</accountType>
</accountTypes>
タイプ「accountType」のサブクラスを作成せずに、これをどのように行うことができますか?必要なものを取得するために使用できるXML属性プロパティはありますか?