简体   繁体   English

如何将该linq表达式转换为方法形式?

[英]How can I convert this linq expression to method form?

How can I convert this linq 如何转换此linq

from f in fake
join r in real
on f.Year equals r.Year
into joinResult
from r in joinResult.DefaultIfEmpty()
select (r == null ? f : r);

in Linq with method form. 在Linq中具有方法形式。

fake.Join(real, ...)

Is there a tool that could help me to do it? 有没有可以帮助我做到这一点的工具?

This is what ReSharper converted it into: 这就是ReSharper将其转换为:

fake.GroupJoin(real, f => f.Year, r => r.Year, (f, joinResult) => new {f, joinResult})
    .SelectMany(@t => @t.joinResult.DefaultIfEmpty(), (@t, r) => (r == null ? @t.f : r));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM