I have the following Code so far:
var lines = from rawLine in File.ReadLines(readFolderFile, Encoding.Default) where !string.IsNullOrEmpty(rawLine) && !string.IsNullOrEmpty(rawLine.Trim(';')) select rawLine;
But now I also need in the first "colum" of my IEnumerable the row count. I tried to adapt from other people who had a more or less similar problem but never got it to work so far.
I tried "solutions" like:
How do you add an index field to Linq results ,
Get record's row number using Linq
and some other ones. I do unterstand, that I need some kind of index, but I dont understand where do I add my .Select(()=> )
What I tried and obsiously doesnt work is:
var lines = (from rawLine in File.ReadLines(readFolderFile, Encoding.Default) where !string.IsNullOrEmpty(rawLine) && !string.IsNullOrEmpty(rawLine.Trim(';'))
select rawLine).Select((rawLine, index) => index++, rawLine);