Hello,
You can open file by file.OpenReadAsync
and read it by StreamReader
.
I notice you want to read one line at a time and put all lines to a List. I use the following code to do it. You do not need update Application Capabilities
var file = await FilePicker.PickAsync();
int counter = 0; string line;
IList<string> currLines = new List<string>();
if (file != null)
{
using (var stream = await file.OpenReadAsync())
{
using (var reader = new StreamReader(stream))
{
// var AllContentFromFile = await reader.ReadToEndAsync();
while ((line = reader.ReadLine()) != null)
{
System.Console.WriteLine(line);
currLines.Add(line);
counter++;
}
}
}
}
var AllLines= counter;
Best Regards,
Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.