Mar 31, 2010 at 10:51 PM
Edited Mar 31, 2010 at 11:00 PM
I am writing multiple json objects to a stream using the following code:
_serializer = new JsonSerializer
DefaultValueHandling = DefaultValueHandling.Ignore,
MissingMemberHandling = MissingMemberHandling.Ignore,
NullValueHandling = NullValueHandling.Ignore
_writer = new JsonTextWriter( new StreamWriter(stream ));
// Then this line is called multiple times.
_serializer.Serialize( _writer, message );
How can I read these objects out one at a time without without consuming all my ram. Note, this stream goes to a file that is 1.6gb of json objects. Ideally I would use a yield return.
When I try to use:
_serializer.Deserialize< T >( _reader );
it reads to the end of the stream. I only want it to read ONE object, then ONE the next time, etc.