example:
[DataContract]
public class TestObject
{
[DataMember]
public string Member1 { get; set; }
[DataMember]
public int Member2 { get; set; }
}
[DataContract]
public class TestClass
{
[DataMember]
public TestObject MyObject1 { get; set; }
[DataMember]
public TestObject MyObject2 { get; set; }
}
TestClass test = new TestClass();
test.MyObject1 = new TestObject();
test.MyObject1.Member1 = "First";
test.MyObject1.Member2 = 100;
test.MyObject2 = test.MyObject1;
The question is - if i send "test" object to a wcf service's method, will the serialization of Member1 and Member2 be doubled (the data will be serialized both for Member1 and Member2 even though they are the same object)?
If this is the case, is there a way to avoid this (serialize the data in MyObject1 once and set MyObject2 to point to the same object in the service side)?