R
Rein Petersen
Hi Folks!
Here's a strange behaviour:
Without a properties SET accessor (see code below), the property will not
serialize.
public class myObject
{
private string _myAttribute;
[XmlAttribute("MyAttrib")]
public string myAttribute
{
get { return _myAttribute; }
set { _myAttribute = value; } //this accessor must be present to
serialize
}
public myObject()
{
_myAttribute="set during construction...";
}
}
I would prefer the property (myAttribute) be accessible only by GET but if I
want it to serialize I must allow the SET. Is there any way around this?
Rein
Here's a strange behaviour:
Without a properties SET accessor (see code below), the property will not
serialize.
public class myObject
{
private string _myAttribute;
[XmlAttribute("MyAttrib")]
public string myAttribute
{
get { return _myAttribute; }
set { _myAttribute = value; } //this accessor must be present to
serialize
}
public myObject()
{
_myAttribute="set during construction...";
}
}
I would prefer the property (myAttribute) be accessible only by GET but if I
want it to serialize I must allow the SET. Is there any way around this?
Rein