Reading Text Files

The simplest way to do this is to use the .Net framework classes: System.IO.File

ReadAllText

1
2
var filePath = @"C:\Users\cpaton\Downloads\hoehoe.txt";
var jsonText = File.ReadAllText(filePath);

ReadLines

1
2
3
4
5
6
var filePath = @"C:\Users\cpaton\Downloads\hoehoe.txt";
var lines = File.ReadLines(filePath);
foreach (var line in lines)
{
//foo
}