using (var file = new StreamReader(fileName)) {
string line;
while((line = file.ReadLine()) != null)
{
System.Console.WriteLine(line);
}
}
using System;
using System.IO;
public class Example
{
public static void Main()
{
string fileName = @"C:examplepath.txt";
using (StreamReader streamReader = File.OpenText(fileName))
{
string text = streamReader.ReadToEnd();
string[] lines = text.Split(Environment.NewLine);
foreach (string line in lines) {
Console.WriteLine(line);
}
}
}
}
string GetLine(string fileName, int line)
{
using (var sr = new StreamReader(fileName)) {
for (int i = 1; i < line; i++)
sr.ReadLine();
return sr.ReadLine();
}
}
string lines = File.ReadAllText(path);
string [] split_arr = lines.Split(';')//files containt ; seprated values
foreach(string l in split_arr)
{
Console.WriteLine(l);
}