xxxxxxxxxx
string lines = File.ReadAllText(path);
string [] split_arr = lines.Split(';')//files containt ; seprated values
foreach(string l in split_arr)
{
Console.WriteLine(l);
}
xxxxxxxxxx
using (var file = new StreamReader(fileName)) {
string line;
while((line = file.ReadLine()) != null)
{
System.Console.WriteLine(line);
}
}
xxxxxxxxxx
using System.IO;
string filePath = "example.txt";
if (File.Exists(filePath))
{
using (StreamReader reader = new StreamReader(filePath))
{
string line;
while ((line = reader.ReadLine()) != null)
{
// Do something with the line
Console.WriteLine(line);
}
}
}