Dataset Write to file
I have DataSet
c 600K records
.
When I try to write this data to a file XML
, I always get OutOfMemoryException
.
Below I am writing the data at the moment.
What is the most memory efficient way?
using (MemoryStream output = new MemoryStream())
{
WorkingDataset.WriteXml(output, XmlWriteMode.WriteSchema);
using (FileStream outputFile = File.Create(FilePath))
{
using (GZipStream compressedStream = new GZipStream(outputFile, CompressionMode.Compress))
{
compressedStream.Write(output.GetBuffer(), 0, (int)output.Length);
}
}
}
+3
source to share
1 answer