Given an immutable class, I would like to use Xml Serialization to
persist and recover this object.  It looks at first glance like Xml
Serialization would require public setters for "A" and "B", which I am
trying to avoid.  Is there a good technique I can use?  Or do I need to
override the serialization?  (This is quite a complex object graph in my
real world example so I'd like to do it as simply as possible).

public class Test {

  public Test(string a, string b) {
    this.a = a;
    this.b = b;
  }

  string a;
  string b;

  public string A {
    get {
      return a;
    }
  }

  public string B {
    get {
      return b;
    }
  }
}

Best wishes
James

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to