c# - CSV File header part is coming parsing by LINQ -


the below way parsing csv file linq found header part coming when inspect user class data. wrong there in code.

    var csvlines = file.readalllines(filename);   // ienumerable<string>     var csvlinesdata = csvlines.select(l => l.split(',').skip(1).toarray());  // ienumerable<string[]>     int flag = 0;     var users = csvlinesdata.select(data => new user     {         csrname = data[6],         callstart = data[0],         callduration = data[1],         ringduration = data[2],         direction = data[3],         isinternal = data[4],         continuation = data[5],         parktime = data[7]     }).tolist(); 

you seem doing skip(1) in wrong place:

var csvlinesdata = csvlines.skip(1).select(l => l.split(',').toarray());  // ienumerable<string[]> 

as stands you're skipping first column each row, not first row.


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -