I am trying to read only the headers from the csv file using CSVHELPER , but I cannot get the GetFieldHeaders() method.
I took the code from this link: Source
public static String[] GetHeaders(string filePath) { using (CsvReader csv = new CsvReader(new StreamReader("data.csv"))) { int fieldCount = csv.FieldCount; string[] headers = csv.GetFieldHeaders();
But GetFieldHeaders does not work.
Note I only want to read the headers from the csv file.
Refresh . The headers in my csv files look like this:
Id,Address,Name,Rank,Degree,Fahrenheit,Celcius,Location,Type,Stats
So can someone tell me what I am missing?
source share