Using LINQ, what is an efficent way to get each string from a tab-delimited .txt file (and then get each word, usually what string.Split(...) does)?
var v = from line in File.ReadAllLines()
select n
Is part of this solution I believe. I don't mind if this uses yield return.
EDIT: I've also seen threads on here detailing exactly what I am trying to do, but can't find them.
I'm not entirely sure what you're asking but it sounds like you're trying to get every word from a tab delimited file as an IEnumerable<string>
. If so then try the following
var query = File.ReadAllLines(somePathVariable)
.SelectMany(x => x.Split(new char[] { '\t' });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With