日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關咨詢
選擇下列產(chǎn)品馬上在線溝通
服務時間:8:30-17:00
你可能遇到了下面的問題
關閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
詳談Linq查詢結(jié)果分析的方法

很多人還不是很了解Linq查詢結(jié)果,為了解決大家的這個盲區(qū),筆者寫了一篇關于內(nèi)容的文章,當你看完本文一定會收獲很大的。

使用Linq查詢結(jié)果:

如果查詢結(jié)果是強類型的,如string[],List 等,就可以不用var類型,而是使用合適的 IEnumerable 或IEnumerable(因為IEnumerable 也擴展了IEnumerable)類型。

 
 
 
  1. class Program   
  2. {    
  3. static void Main(string[] args)   
  4. {  Console.WriteLine("***** LINQ Transformations *****"n");   
  5. IEnumerable subset = GetStringSubset();    
  6. foreach (string item in subset)    
  7. {   
  8. Console.WriteLine(item);    
  9. }    
  10. Console.ReadLine();    
  11. }  
  12. static IEnumerable GetStringSubset()   
  13. {    
  14. string[] currentVideoGames = {"Morrowind", "BioShock",    
  15. "Half Life 2: Episode 1", "The Darkness",    
  16. "Daxter", "System Shock 2"};    
  17. // Note subset is an IEnumerable  compatible object.   
  18. IEnumerable subset = from g in currentVideoGames    
  19. where g.Length > 6   
  20. orderby g    
  21. select g;    
  22. return subset;    
  23. }  
  24. }  

使用Linq查詢結(jié)果的分頁處理:

 
 
 
  1. var custTotalOrders = from c in db.D_WorkCenter    
  2. //join o in db.Orders    
  3. //on c.CustomerID equals o.CustomerID into custOrders    
  4. //from o in custOrders  select new    
  5. {    
  6. WorkCenterID = c.WorkCenterID,    
  7. WorkCenterName = c.WorkCenterName    
  8. //OrderTotal = o.Order_Details.Sum(d => d.UnitPrice * d.Quantity)   
  9. }  

以上就是對Linq查詢結(jié)果的簡單分析。

【編輯推薦】

  1. 簡單解決Linq多條件組合問題
  2. 將數(shù)據(jù)源進行Linq排序
  3. Ordering方法實現(xiàn)Linq排序
  4. 輕輕松松學習Linq排序
  5. 詳解Linq聯(lián)合查詢表結(jié)果集的返回

網(wǎng)站欄目:詳談Linq查詢結(jié)果分析的方法
當前路徑:http://www.dlmjj.cn/article/dpchogo.html