I am using LinQPad4 for my first time. I have run one of the LinQ query examples in the program,and when I press the Lambda bottom , the program doesn't show the query transformed into Lambda, can anyone help me please?
var words = from word in "The quick brown fox jumps over the lazy dog".Split()
orderby word.ToUpper()
select word;
var duplicates = from word in words
group word.ToUpper() by word.ToUpper()
into g
where g.Count() > 1
select new { g.Key, Count = g.Count() };
words.Dump();
duplicates.Dump();
If it's a local query, you'll need to insert .AsQueryable()
into the query so that an expression tree is generated. This is explained in the built-in sample, A Note on AsQueryable
var names = new[] { "Tom", "Dick", "Harry", "Mary", "Jay" }.AsQueryable();
// AsQueryable() doesn't change the result of the query. The effect it has it to populate
// the λ tab below—so you can see how the query translates into lambda (fluent) syntax.
// To illustrate, press F5 to run the following:
(
from n in names
where n.Length > 3
orderby n descending
select n.ToUpper()
)
.Dump ("Click the λ button - notice the translation to fluent syntax");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.