There is an unsaved comment in progress. You will lose your changes if you continue. Are you sure you want to reopen the work item?
Poor support for IEnumerable patterns
One can read data from a database through an IEnumerable interface, stream through the JSON.Net serialize and optionally compress.
If the data is received over network, the receiver may optionally decompress but cannot deserialize with an IEnumerable interface, not without specialized configuration/hookup or a custom deserializer. Many would simply receive the data and deserialize as a
List<>. This is fine in most cases, but when there are larger data sets to stream, this becomes unwieldy, overburdening the memory.
In cases where the data only needs to be read once, native IEnumerable support is desirable. I understand that provision of an interface does not automatically bind to a concrete object. But we don't want that. IEnumerable is special, it is like a collection,
but it's read once. It requires the elements to be yielded from a function.
I have managed to implement an IEnumerable deserializer using a JsonTextReader object. An IEnumerable collection need to be located at the end of objects, as they delayed access would certainly interfere with other member access otherwise.
I believe this can be implemented in JSON.Net quite simply, but would require a fair amount of time. I will be following up this issue with a reference to my custom open source example.