public class PVSystModel { public string E_Grid { get; set; } } internal class Program { static void Main(string[] args) { List<PVSystModel> pVSystModels = new List<PVSystModel>(); var config = new CsvConfiguration(CultureInfo.InvariantCulture) { HasHeaderRecord = false, Delimiter = "," }; using (var reader = new StreamReader(Config.FILE_PATH)) using (var csv = new CsvReader(reader, config)) { int header_rows_to_skip = 14; int row_counts = 0; while (csv.Read()) { row_counts++; if (row_counts < header_rows_to_skip) continue; string E_GridValue = csv.GetField(4); pVSystModels.Add(new PVSystModel { E_Grid = E_GridValue }); // // do something like adding it to a list of string } } foreach (PVSystModel pvsysModel in pVSystModels) { Console.WriteLine(pvsysModel.E_Grid); } Console.ReadKey(); } }
internal class Program { static void Main(string[] args) { var config = new CsvConfiguration(CultureInfo.InvariantCulture) { HasHeaderRecord = false, Delimiter = "," }; using (var reader = new StreamReader(Config.FILE_PATH)) // replace by the path of your file using (var csv = new CsvReader(reader, config)) { int header_rows_to_skip = 14; int row_counts = 0; while (csv.Read()) { row_counts++; if (row_counts < header_rows_to_skip) continue; string E_GridValue = csv.GetField(4); Console.WriteLine(E_GridValue); // do something like adding it to a list of string } } Console.ReadKey(); } }