string grid = @"08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08";
string[] res = grid.Split(' ');
var lowNums = from n in res
where n.Length > 0
select int.Parse(n);
I am having trouble converting the above linQ statement to a lambda WHERE equivalent.
The following works, but only returns am enumernable<string> whereas I want an enumerable<int>:
IEnumerable<string> all = res.Where(x => x.Length > 0);
What you want to do then is carefully read section 7.16.2 of the C# specification. It will walk you step-by-step through the process.
It says:
So your query
is translated into
That’s the first stage of the translation. Now go back to the spec again:
So your translated-once-already query
is further translated into
and now it is not a query expression any more, so no more syntactic translation is done.