新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
LINQ查詢結(jié)果分析
本文向大家介紹LINQ查詢結(jié)果,可能好多人還不了解LINQ查詢結(jié)果,沒有關(guān)系,看完本文你肯定有不少收獲,希望本文能教會你更多東西。

使用LINQ查詢結(jié)果
如果查詢結(jié)果是強(qiáng)類型的,如string[],List
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("***** LINQ Transformations *****"n");
- IEnumerable
subset = GetStringSubset(); - foreach (string item in subset)
- {
- Console.WriteLine(item);
- }
- Console.ReadLine();
- }
- static IEnumerable
GetStringSubset() - {
- string[] currentVideoGames = {"Morrowind", "BioShock",
- "Half Life 2: Episode 1", "The Darkness",
- "Daxter", "System Shock 2"};
- // Note subset is an IEnumerable
compatible object. - IEnumerable
subset = from g in currentVideoGames - where g.Length > 6
- orderby g
- select g;
- return subset;
- }
- }
使用LINQ查詢結(jié)果的分頁處理:
- 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 to SQL學(xué)習(xí)經(jīng)驗(yàn)
- Linq隱式類型化局部變量
- Linq匿名類型簡單概述
- Linq Lambda表達(dá)式剖析
- Linq對象初始值淺談
分享題目:LINQ查詢結(jié)果分析
鏈接URL:http://m.fisionsoft.com.cn/article/cdeepog.html


咨詢
建站咨詢
