ラクダを使用するために、ラクダケーシングのアイテムのコレクションをエクスポートする必要があります。XMLSerializerはコレクション内のアイテムを大文字にします。
クラス自体:
[XmlRoot("example")]
public class Example
{
[XmlElement("exampleText")]
public string ExampleText { get; set; }
}
これは罰金シリアライズ:
<example>
<exampleText>Some text</exampleText>
</example>
ラッパー:
[XmlRoot("examples")]
public class ExampleWrapper : ICollection<Example>
{
[XmlElement("example")]
public List<Example> innerList;
//Implementation of ICollection using innerList
}
これは、しかし、いくつかの理由で包まれたExample
Sを大文字、私がしようとしましたそれをXmlElement
で上書きしますが、これは目的の効果がないようですct:
<examples>
<Example>
<exampleText>Some text</exampleText>
</Example>
<Example>
<exampleText>Another text</exampleText>
</Example>
</examples>
私は何が間違っているのか、それとも簡単な方法があるのか教えていただけますか?
「Example」型の名前をworkaroundとして「example」に変更することができます...慣習を破るために立つことができる場合... – RichardTowers