c# stream to text file code example
Example 1: C# save pdf stream to file
using (var fileStream = File.Create("C:\\Path\\To\\File"))
{
myStream.Seek(0, SeekOrigin.Begin);
myStream.CopyTo(fileStream);
}
Example 2: c# read file stream
//this will get a string with all the text from the file
var fileText = File.ReadAllText(@"path\to\my\file.txt");
//this will get all of the lines of the file as an string[]
var fileLines = File.ReadAllLines(@"path\to\my\file.txt");