日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

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

新聞中心

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

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

使用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. 輕輕松松學(xué)習(xí)Linq排序
  5. 詳解Linq聯(lián)合查詢表結(jié)果集的返回

分享標(biāo)題:詳談Linq查詢結(jié)果分析的方法
URL分享:http://m.5511xx.com/article/dpchogo.html