count lines with linq

Jun 11, 08

so i needed to count the lines of a bunch of different filetypes in a folder. i decided to try using linq for this. here’s what i came up with. basically a single linq statement 😛

you can tune the regex to taste. i just said (i think, i’m not a regex wizard) something that isn’t a newline (.+) and the line terminators i’m using (\r\n).