[英]Adding a Condition to a LINQ join
I'm working with the following linq query: 我正在使用以下linq查询:
var docList = from c in container.DocumentDeliveryPreferences
join o in container.Documents on c.DocumentId equals o.DocumentId
select new { o.Name, o.DocumentType, c.CustomerId };
How can I modify this to select only Documents where c.CustomerId equals X(some paramenter)? 我如何修改它以仅选择c.CustomerId等于X(某些参数)的Document?
You could try something the following: 您可以尝试以下操作:
var docList = from c in container.DocumentDeliveryPreferences
join o in container.Documents
on c.DocumentId equals o.DocumentId
where c.CustomerId == X
select new { o.Name, o.DocumentType, c.CustomerId };
where X
is your parameter. 其中X
是您的参数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.