Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/289.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# linQ到lambda的转换在linQpad4中不起作用_C#_Linqpad - Fatal编程技术网

C# linQ到lambda的转换在linQpad4中不起作用

C# linQ到lambda的转换在linQpad4中不起作用,c#,linqpad,C#,Linqpad,我第一次使用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 word

我第一次使用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的注释


如果是本地查询,则需要在查询中插入.AsQueryable,以便生成表达式树。这在内置示例中进行了解释,该示例是关于AsQueryable的注释


你尝试了什么查询?@PeterSmithvar words=来自《棕色狐狸跳过懒狗》中的word;var duplicates=从words-in-words组word.ToUpper逐word.ToUpper进入g,其中g.Count>1选择new{g.Key,Count=g.Count};字。倾倒;重复。转储;你尝试了什么查询?@PeterSmithvar words=来自《棕色狐狸跳过懒狗》中的word;var duplicates=从words-in-words组word.ToUpper逐word.ToUpper进入g,其中g.Count>1选择new{g.Key,Count=g.Count};字。倾倒;重复。转储;恐怕LinQPad4不接受var names=new[]{Tom,Dick,Harry,Mary,Jay}.AsQueryable的语法;它说缺少一个右括号,我在VisualStudio2012中检查了这个查询,它没有语法错误。所以我不能运行这个程序query@Goldffy:您必须将语言切换为C语句才能运行此查询。恐怕LinQPad4不接受var names=new[]{Tom,Dick,Harry,Mary,Jay}.AsQueryable的语法;它说缺少一个右括号,我在VisualStudio2012中检查了这个查询,它没有语法错误。所以我不能运行这个程序query@Goldffy:您必须将语言切换为C语句才能运行此查询。
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");