I would like to take a text file with a lot of lines and turn it into an array. For example if the text file was:
Line 1
Line 2
Line 3
Line 4`
It would result in
string[] stringList = { "Line 1", "Line 2", "Line 3", "Line 4" };
How do I do this?
I've tried this:
string line;
string[] accountList;
using (StreamReader file = new StreamReader(accountFileLocation.Text))
{
while (line = file.ReadLine() != null)
{
stringList += line;
}
}
However that errors with:
Cannot implicitly convert type 'bool' to 'string'
Cannot convert type 'string' to 'string[]'
Cannot implicitly convert type 'string' to 'string[]'