I am using the following code to read a text file from the Assets Folder into a string and the split it into array
string filepath = @"Assets\DATA.csv";
StorageFolder folder = Windows.ApplicationModel.Package.Current.InstalledLocation;
StorageFile file = await folder.GetFileAsync(filepath); // error here
var Lines = await Windows.Storage.FileIO.ReadTextAsync(file);
string[] lines2 = Lines.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
This works fine but the textfile is now over 500 lines and I am getting an exception as its too big to fit in the string
Is there a way of reading the text file directly into an array a line at a time Each line is terminated by a newline
I have searched and there seem to be a way of doing it using file. class but I can get it to work.
Use
System.IO.File.ReadLines(filepath)
https://msdn.microsoft.com/en-us/library/vstudio/system.io.file.readlines(v=vs.100).aspx