我是第一次使用LinQPad4。我在程序中运行了一个LinQ查询示例,当我按下Lambda底部时,程序没有显示转换为Lambda的查询,请问有人可以帮助我吗?
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();
如果是本地查询,则需要将.AsQueryable()
插入到查询中,以便生成表达式树。关于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");