c#Linq Lamba表达 [英] c# Linq Lamba expression

查看:69
本文介绍了c#Linq Lamba表达的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有2个记录清单

我想基于多种条件进行加入,例如&&,||



任何人都可以帮我解决这个问题,因为我是Linq的新手。

解决方案

你应该看看 101 LINQ样本 [ ^ ]您将在那里找到所需的一切:)


将您的表名和列名放在以下查询中: -



 来自 t1  项目
来自 t2 in 任务。其中(x => t1.ProjectID == x.ProjectID&& x.Completed == true)
。 DefaultIfEmpty()
选择 new {t1.ProjectName,t2.TaskName}





这是你可以修改它的基本查询。

Hi,
i Have 2 List of records
i want to make a join based on multiple condtions like && , ||

Can any one help me with this query as i am new to Linq.

解决方案

You should take a look at 101 LINQ Samples[^] You will find everything you need there :)


Put your table name and column name in below query:-

from t1 in Projects
from t2 in Tasks.Where(x => t1.ProjectID == x.ProjectID && x.Completed == true)
                .DefaultIfEmpty()
select new { t1.ProjectName, t2.TaskName }



this is basic query you can modify it.


这篇关于c#Linq Lamba表达的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆