I am having a problem I've got a big class, in that class Ive 4 properties that contains other class, ant that class contain various lists and models(simple class with properties)
Class looks like:
[Serializable]
public class BackupProject
{
public DocumentSet Documents;
public CompareSet MetaData;
public RelationshipSet Relationships;
public Dictionary<string, ItemConfig> DocumentData;
}
To serialize I'm using :
using (FileStream stream = File.Open(fullPath + "/" + backupFile, FileMode.Create))
{
stream.Position= 0;
var bformatter = new BinaryFormatter();
using (ZipOutputStream zipStream = new ZipOutputStream(stream))
{
zipStream.SetLevel(9);
ZipEntry zipEntry = new ZipEntry("BackupProject") {DateTime = DateTime.Now};
zipStream.PutNextEntry(zipEntry);
bformatter.Serialize(zipStream, documents);
}
}
As you see I tried data compression and still I am getting:
System.Runtime.Serialization.SerializationException "The internal array cannot expand to greater than Int32.MaxValue elements."
That's why I need to chunk up this class, But have no idea how to do it witch such irregular class content.