C#使用linq查詢大數據集的方法
更新時間:2015年04月02日 09:56:30 作者:令狐不聰
這篇文章主要介紹了C#使用linq查詢大數據集的方法,涉及C#調用linq進行數據查詢的技巧,具有一定參考借鑒價值,需要的朋友可以參考下
本文實例講述了C#使用linq查詢大數據集的方法。分享給大家供大家參考。具體如下:
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace LargeNumberQuery { class Program { static void Main(string[] args) { int[] numbers = CreateNumbers(7384738); Console.WriteLine("Numbers less than 2000:"); var queryResults = from n in numbers where n < 2000 select n; foreach (var item in queryResults) { Console.WriteLine(item); } Console.ReadLine(); } private static int[] CreateNumbers(int count) { Random generator = new Random(0); int[] result = new int[count]; for (int i = 0; i < count; i++) { result[i] = generator.Next(); } return result; } } }
希望本文所述對大家的C#程序設計有所幫助。
相關文章
C#實現輸入10個數存入到數組中并求max和min及平均數的方法示例
這篇文章主要介紹了C#實現輸入10個數存入到數組中并求max和min及平均數的方法,涉及C#簡單數據轉換與數值運算相關操作技巧,需要的朋友可以參考下2017-07-07C#簡單讀取、改變文件的創(chuàng)建、修改及訪問時間的方法
這篇文章主要介紹了C#簡單讀取、改變文件的創(chuàng)建、修改及訪問時間的方法,涉及C#文件類SetCreationTime、SetLastWriteTime及SetLastAccessTime的相關使用技巧,需要的朋友可以參考下2015-07-07