-
Type: Improvement
-
Resolution: Done
-
Priority: Minor - P4
-
None
-
Affects Version/s: 1.8.1
-
Component/s: Serialization
-
Environment:Windows
Serializing complex documents that have many optional lists results in the explicit serialization of an empty collection (i.e. []), which is a waste of space, and makes indexes unnecessarily large and clumpy.
I have littered my classes with a bunch of "ShouldSerializeXXX" methods, which does resolve the issue, at the cost of some additional typing. But I think it would be useful to implement this as a convention. That way, it could be established as the default, and would provide a more robust way of implementing this option globally (for all collection or IEnumerable types).
It may be possible to do currently, but I haven't figured out how to do it. I suspect that this option might by widely useful.
- related to
-
CSHARP-767 Add an overload of SetDefaultValue that supports creating a new instance of the default value each time
- Closed