私のxsd.exe
- 生成されたクラスは、私がそれらをしたいと正確にシリアライズしていません。 InterestInProperty
をシリアライズ版に表示する方法を教えてもらえますか?オーバーライドされたメンバーが正しくシリアル化されていません
ここに投稿するには、生成されたクラスが長すぎます(14,000行のC#)がありますが、関連する抜粋を表示しようとします。参考のために、here is the full schema。
私は1つのチャンクが、これにシリアライズしたい:のはInterestInProperty
を直列化するためのソリューションがReasonFor
に適用されると仮定しましょう当分の間
<FullRegistered ValSubType="Standard">
...
</FullRegistered>
:
<FullRegistered ValSubType="Standard" ReasonFor="FairMarketValue" InterestInProperty="FeeSimpleInPossession">
...
</FullRegistered>
が、それは実際にこれに直列化です。
ここFullRegistered
項目が含まれているValuationType
クラスだ:
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = false)]
public partial class ValuationType
{
private Identifier[] identifierField;
private object itemField;
[System.Xml.Serialization.XmlElementAttribute("Identifier")]
public Identifier[] Identifier
{
get { return this.identifierField; }
set { this.identifierField = value; }
}
[System.Xml.Serialization.XmlElementAttribute("Costing", typeof (Costing))]
[System.Xml.Serialization.XmlElementAttribute("FullRegistered", typeof (FullRegistered))]
[System.Xml.Serialization.XmlElementAttribute("ProgressInspection", typeof (ProgressInspection))]
[System.Xml.Serialization.XmlElementAttribute("RestrictedAccessAssessment", typeof (RestrictedAccessAssessment))]
[System.Xml.Serialization.XmlElementAttribute("WorkFlow", typeof (WorkFlow))]
public object Item
{
get { return this.itemField; }
set { this.itemField = value; }
}
}
はここFullRegistered
の要約定義です:
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = false)]
public partial class FullRegistered
{
private FullRegisteredInterestInProperty interestInPropertyField;
private bool interestInPropertyFieldSpecified;
private FullRegisteredValSubType valSubTypeField;
private FullRegisteredReasonFor reasonForField;
private bool reasonForFieldSpecified;
[System.Xml.Serialization.XmlAttributeAttribute()]
public FullRegisteredInterestInProperty InterestInProperty
{
get { return this.interestInPropertyField; }
set { this.interestInPropertyField = value; }
}
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool InterestInPropertySpecified
{
get { return this.interestInPropertyFieldSpecified; }
set { this.interestInPropertyFieldSpecified = value; }
}
[System.Xml.Serialization.XmlAttributeAttribute()]
public FullRegisteredValSubType ValSubType
{
get { return this.valSubTypeField; }
set { this.valSubTypeField = value; }
}
[System.Xml.Serialization.XmlAttributeAttribute()]
public FullRegisteredReasonFor ReasonFor
{
get { return this.reasonForField; }
set { this.reasonForField = value; }
}
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool ReasonForSpecified
{
get { return this.reasonForFieldSpecified; }
set { this.reasonForFieldSpecified = value; }
}
}
そしてFullRegisteredInterestInProperty
列挙:
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public enum FullRegisteredInterestInProperty
{
CrownLeasehold,
FeeSimpleInPossession,
ACTLeasehold,
LeaseholdInterest,
Lessors,
Lessees,
SharesInCompany,
SubjectToLongTermLease,
Timeshare,
UnitsInTrust,
Other,
}
プライベート変数はシリアル化されません。公開する。 – jdweng
@jdweng、プライベートフィールドは実際には 'public FullRegisteredInterestInProperty InterestInProperty'のようなパブリックプロパティのフィールドをバッキングしています – OutstandingBill