save file with stream is better code example
Example: C# save pdf stream to file
using (var fileStream = File.Create("C:\\Path\\To\\File"))
{
myStream.Seek(0, SeekOrigin.Begin);
myStream.CopyTo(fileStream);
}
using (var fileStream = File.Create("C:\\Path\\To\\File"))
{
myStream.Seek(0, SeekOrigin.Begin);
myStream.CopyTo(fileStream);
}