initializing a property inside a constructor when deserializing



I use Xsd2Code to generate classes. However one of the classes causes me a problem with its constructor, because of the loop and throws StackOverflowException.



[System.CodeDom.Compiler.GeneratedCodeAttribute("Xsd2Code", "3.4.0.32990")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = true)]
public partial class ApproverType : INotifyPropertyChanged
{
private ApproverType replacesField;

public ApproverType()
{
this.replacesField = new ApproverType();
}

public ApproverType Replaces
{
get
{
return this.replacesField;
}
set
{
if ((this.replacesField != null))
{
if ((replacesField.Equals(value) != true))
{
this.replacesField = value;
this.OnPropertyChanged("Replaces");
}
}
else
{
this.replacesField = value;
this.OnPropertyChanged("Replaces");
}
}
}
}

No comments:

Post a Comment