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

使用LINQ查詢(xún)結(jié)果
如果查詢(xún)結(jié)果是強(qiáng)類(lèi)型的,如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查詢(xún)結(jié)果的分頁(yè)處理:
- 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隱式類(lèi)型化局部變量
- Linq匿名類(lèi)型簡(jiǎn)單概述
- Linq Lambda表達(dá)式剖析
- Linq對(duì)象初始值淺談
當(dāng)前題目:LINQ查詢(xún)結(jié)果分析
鏈接地址:http://www.5511xx.com/article/cdeepog.html


咨詢(xún)
建站咨詢(xún)
