本文介绍了Lambda表达式问题。这种语法是否正确?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我不确定我的表情是否正确。如果有任何语法错误,请更正我。



这必须按PipelineName = Utility过滤(以下代码不按实用程序过滤)

我希望它只应该为我们作为参数传递的那些实用程序提取。

我能理解很难提供所提供信息的解决方案但是,这就是我所拥有的。

任何信息都很明显。



Hi,
I am not sure if my expression is correctly. Correct me if anything syntax is wrong.

This has to filter by PipelineName = Utility (This following code is not filtering by utility)
I am expecting it should pull only for those utility we are passing as a parameter.
I can understand it is difficult to provide solution with the information provided but, this is what I have.
Any information is appreciable.

// utility (pipeline)
            if (!string.IsNullOrWhiteSpace(utility))
            {
                submissions = submissions.Where(s => s.SummaryBillMaster.BillingGroupFacilityCollection.Select(f => f.Facility).Select(d => d.DealCollection.Select(p => p.Pipeline.PipelineName == utility  && p.Period == s.Period)).Any());
            }













谢谢!



我的尝试:



//实用程序(管道)

if(!string.IsNullOrWhiteSpace(utility))

{

提交=提交.Where(s => s.SummaryBillMaster.BillingGroupFacilityCollection.Select(f => f.Facility).Select(d => d.DealCollection.Select(p => p.Pipeline.PipelineName == utility& & p.Period == s.Period))。Any());

}







Thanks!

What I have tried:

// utility (pipeline)
if (!string.IsNullOrWhiteSpace(utility))
{
submissions = submissions.Where(s => s.SummaryBillMaster.BillingGroupFacilityCollection.Select(f => f.Facility).Select(d => d.DealCollection.Select(p => p.Pipeline.PipelineName == utility && p.Period == s.Period)).Any());
}

推荐答案

Select() method works as projection. So it always will return class with properties.
so your lambda expression should look like by that way

if (!string.IsNullOrWhiteSpace(utility))
{
      submissions = submissions
          .Where(s => s.SummaryBillMaster.BillingGroupFacilityCollection
              .Where(p => p.Pipeline.PipelineName == utility && p.Period == s.Period))
              .Select(f => f.Facility.DealCollection)
              .Any()
          );
}


这篇关于Lambda表达式问题。这种语法是否正确?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-16 07:29