LINQ有两个或多个查询? [英] LINQ with two or more queries?
本文介绍了LINQ有两个或多个查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们如何在linq语句中使用两个或多个查询.
How we can use two or more queries in a linq statement.
推荐答案
如果我正确理解了您的声明,那么我认为您想执行两种不同的操作,例如预测和订购.
例如-我需要获得所有客户,然后我需要根据公司名称进行排序.
然后
LINQ查询-
Hi,
If i understood your statement properly, then i am thinking that you want to perform two different actions such as projections and Ordering.
For instance - I need to get all the customers and then i need to sort based on Company name.
Then
LINQ Query -
context.Customers.Select(c => c).OrderBy(c => c.CompanyName).ToList();
问候,
-Vinayak
Regards,
-Vinayak
此语句等效于查询的where
条款中的AND功能
This statement does the equivalent of AND function in thewhere
clause of a query
query = from b in query
select b;
query = query.where(col => col.Title.Contains(title));
query = query.where(col => col.Author.Contains(author)
这篇关于LINQ有两个或多个查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文