You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`
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 ?
Thanks.
The text was updated successfully, but these errors were encountered:
laloutre87
changed the title
Serializing auto-generated properties but not callign regular properties getter.
Serializing auto-generated properties but not calling regular properties getters.
Nov 19, 2021
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.
The text was updated successfully, but these errors were encountered: