Textdatei in List<String> einlesen
/// <summary>
/// Reads the text file.
/// </summary>
/// <param name="path">The path.</param>
/// <returns></returns>
private static List<String> ReadTextFile(string path)
{
List<String> lines = new List<String>();
using (StreamReader sr = new StreamReader(path, Encoding.Default))
{
while (sr.Peek() != -1)
lines.Add(sr.ReadLine());
}
return lines;
}
2 Kommentare zum Snippet