I have a tab delimited file with some columns and rows for example: some rows might not have value for some columns. What we know is that the \"order\" doe
You can use File.ReadLines() method (if you are using .NET Framework Version 4.0 or above) without any performance penalty as it would not load whole file content into Memory.
Try This:
using System.IO;
class FileData
{
public string Column2{ get; set; }
public string Column12{ get; set; }
public string Column45{ get; set; }
}
List filedata = new List();
FileData temp = new FileData();
foreach(var line in File.ReadLines("filepath.txt").Skip(1))
{
var tempLine = line.Split('\t');
temp.Column2 = tempLine[1];
temp.Column12 = tempLine[11];
temp.Column45 = tempLine[44];
filedata.Add(temp);
}