C#: Read or Write a File in One Line

If buffering and streaming performance aren’t required, here are six examples on how to use System.IO.File to read/write strings, string arrays, and byte arrays from/to a file in just one line without having to loop through blocks or worrying about closing or disposing: using System.IO; … const string inputFilename = @”c:\foo.dat”; string inString = File.ReadAllText(inputFilename); … Read moreC#: Read or Write a File in One Line