Hi, I have the class and struct shown below. If I serialize the class as is using xmlserializer I get:
< Test>
< TestNumber1 >5< /TestNumber1 >
< InnerTest / >
< /Test >
what is the easiest way to make InnerTest serialise properly (preferably using xmlserializer) with out giving the Number property a setter?
Thanks, Nick
public class Test
{
private InnerTest innerTest;
private int testNumber;
public Test()
{
this.innerTest = new InnerTest();
this.testNumber = 5;
}
public int TestNumber1
{
get { return this.testNumber; }
set { this.testNumber = value;}
}
public InnerTest InnerTest
{
get { return this.innerTest; }
set { this.innerTest = value;}
}
}
public struct InnerTest
{
private int number;
public InnerTest(int number)
{
this.number = number;
}
public int Number{get { return number; }}
}