C# write stream as file 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);
}