Read a specific column from a csv file in C#

后端 未结 6 1389
天命终不由人
天命终不由人 2021-01-23 21:44

I have a simple 3 column csv file and i need to exctract only the information from the first column. I was thinking of regular expressions, but i am hoping there is an easier mo

6条回答
  •  面向向阳花
    2021-01-23 22:38

    If you want to extract that data into a class object, CsvHelper (a library I maintain) is a good option.

    var csv = new CsvHelper( File.OpenRead( "file.csv" ) );
    var myCustomObjects = csv.Reader.GetRecords();
    

提交回复
热议问题