I have a text file that I want to read in and put each line from the file into its own string. So the file will have 4 lines:
2017-01-20
05:59:30
+353879833382
971575 Michael
So in the code I need to read in the file and split up each line and put them into a string i.e the first line will equal to string date, second line will equal to string time etc
Code:
public static void ParseTXTFile(string FileName, int CompanyID)
{
try
{
FileInfo file = new FileInfo(FileName);
string Date;
string Time;
string Phone;
string JobNo;
string Name;
using (CsvReader reader = new CsvReader(new StreamReader(FileName), false))
{
while (reader.ReadNextRecord())
{
}
}
}
catch (Exception ex)
{
throw (ex);
}
}
How do I read in each line of the file and set it to a string?