c# - How to read a header from a specific line with CsvHelper? -


i'm trying read csv file header @ row 3:

some crap line empty line col1,col2,col3,... val1,val2,val3 val1,val2,val3 

how tell csvhelper header not @ first row?

i tried skip 2 lines read() succeeding call readheader() throws exception header has been read.

using (var csv = new csvreader(new streamreader(stream), csvconfiguration)) {    csv.read();    csv.read();    csv.readheader();    ..... 

if set csvconfiguration.hasheaderrecord false readheader() fails again.

try this:

using (var reader = new streamreader(stream)) {       reader.readline();       reader.readline();       using (var csv = new csvreader(reader)) {                               csv.readheader();                         } } 

Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -