0

I am having a problem, I need to serialize really big objects using.

using (FileStream stream = File.Open(fullPath + "/" + backupFile, FileMode.Create))
{
    var bformatter = new BinaryFormatter();
    bformatter.Serialize(stream, documents);
}

On 64x Architecture and with Im having no Out Of Memmory issue, but now im getting

The internal array cannot expand to greater than Int32.MaxValue elements

Serialized object contains 4 properties that contains other objects (example 43000 objects that contains 60 properties and all are needed).

Is there a way to solve this, increase that limit maybe or compress data?

Yuval Itzchakov
  • 146,575
  • 32
  • 257
  • 321
Wojciech Szabowicz
  • 3,646
  • 5
  • 43
  • 87
  • Have you go through this link http://stackoverflow.com/questions/569127/serializationexception-when-serializing-lots-of-objects-in-net – Damith Oct 15 '15 at 12:34
  • There could be multiple ways to approach this. You could try compression, you could try streaming the data instead of serializing it all at once, you could try only serializing some of the data separately. – Yuval Itzchakov Oct 15 '15 at 12:35
  • Hmmm, by chunks, is there an example how to do that? – Wojciech Szabowicz Oct 15 '15 at 20:13

0 Answers0