I am trying to read an uploaded CSV file and before doing anything with the data I need to check the first header name to be sure it is the correct file. I have been trying to find a way to do it but the reader skips to the second row instead. Is there a direct way of selecting one of the headers and checking its value?
You can use the CsvReader to get the header row strings as described in this answer:
using (var csv = new CsvReader(reader))
{
csv.Read();
csv.ReadHeader();
string[] headerRow = csv.Context.HeaderRecord;
}