`
public class MyObject {
private object _SuperLongToCalculateField = null;
public object SuperLongToCalculateField {
get {
if (_SuperLongToCalculateField == null) {
Thread.Sleep(200000); // long calculation done here.
_SuperLongToCalculateField = "some value";
}
return _SuperLongToCalculateField;
}
set {
_SuperLongToCalculateField = value;
}
}
public int AnotherProperty { get; set; }
}
`
Because it seems like the getter of SuperLongToCalculateField is called.
Putting the SerializerConfig "DefaultTargets" value to "TargetMember.AllFields", solve the speed problem, but then "AnotherProperty" isn't serialized.
Would it be possible to have a DefaultTargets settings to save all fields + auto-generated properties ( " get; set; " ) only ?
Or is it already there and I am missing something ?
Serializing object defined like that is long :
` public class MyObject { private object _SuperLongToCalculateField = null;
} `
Because it seems like the getter of SuperLongToCalculateField is called.
Putting the SerializerConfig "DefaultTargets" value to "TargetMember.AllFields", solve the speed problem, but then "AnotherProperty" isn't serialized.
Would it be possible to have a DefaultTargets settings to save all fields + auto-generated properties ( " get; set; " ) only ? Or is it already there and I am missing something ?
Thanks.