这篇文章给大家介绍Linq中怎么分析查询结果,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。使用Linq查询结果:如果查询结果是强类型的,如string[],List等,就可以不用var类型,而是使用合适的 IEnume
这篇文章给大家介绍Linq中怎么分析查询结果,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。
使用Linq查询结果:
如果查询结果是强类型的,如string[],List
class Program { static void Main(string[] args) { Console.WriteLine("***** LINQ TransfORMations *****"n"); IEnumerable<string> subset = GetStringSubset(); foreach (string item in subset) { Console.WriteLine(item); } Console.ReadLine(); } static IEnumerable<string> GetStringSubset() { string[] currentVideoGames = {"Morrowind", "BiOShock", "Half Life 2: Episode 1", "The Darkness", "Daxter", "System Shock 2"}; // Note subset is an IEnumerable compatible object. IEnumerable<string> subset = from g in currentVideoGames where g.Length > 6 orderby g select g; return subset; } }
使用Linq查询结果的分页处理:
var custTotalOrders = from c in db.D_WorkCenter //join o in db.Orders //on c.CustomerID equals o.CustomerID into custOrders //from o in custOrders select new { WorkCenterID = c.WorkCenterID, WorkCenterName = c.WorkCenterName //OrderTotal = o.Order_Details.Sum(d => d.UnitPrice * d.Quantity) }
关于Linq中怎么分析查询结果就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。
--结束END--
本文标题: Linq中怎么分析查询结果
本文链接: https://www.lsjlt.com/news/293466.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0