I have a linq query where I am reading all the lines of a CSV the file has extra rows at the end that have no data. I need to filter out those rows so that it only has the rows with data I am using the following query but it still returns like 8000 rows and there are only 52 with data in them.
var query =
from c in
(from line in File.ReadAllLines(excelFile)
let transactionRecord = line.Split(',')
select new Transaction()
{
TxnId = transactionRecord[12],
})
where c.TxnTax != string.Empty
select c;
Not relaly sure why this is happening? Doe anyone have any ideas?
from line in File.ReadAllLines(excelFile) where !string.IsNullOrWhitespace(line)c.TxnTax? If not, then it will benullfor all results anyway, so no point testing that. I believe my other comment is the solution anyway