Answers for "c# fastest way to write and read to file"

C#
5

write text files with C#

// Create a file to write to.
string createText = "Hello and Welcome" + Environment.NewLine;
File.WriteAllText(path, createText);

...

// Open the file to read from.
string readText = File.ReadAllText(path);
Posted by: Guest on October-23-2020
0

c# read file while writing

using (var fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
using (var sr = new StreamReader(fs, Encoding.Default)) {
    // read the stream
    //...
}
Posted by: Guest on August-23-2021

Code answers related to "c# fastest way to write and read to file"

C# Answers by Framework

Browse Popular Code Answers by Language