C#使用linq查詢大數(shù)據(jù)集的方法
更新時間:2015年04月02日 09:56:30 作者:令狐不聰
這篇文章主要介紹了C#使用linq查詢大數(shù)據(jù)集的方法,涉及C#調(diào)用linq進行數(shù)據(jù)查詢的技巧,具有一定參考借鑒價值,需要的朋友可以參考下
本文實例講述了C#使用linq查詢大數(shù)據(jù)集的方法。分享給大家供大家參考。具體如下:
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#程序設(shè)計有所幫助。
相關(guān)文章
C#統(tǒng)計字符串中數(shù)字個數(shù)的方法
這篇文章主要介紹了C#統(tǒng)計字符串中數(shù)字個數(shù)的方法,涉及C#遍歷字符串并判斷數(shù)字的技巧,需要的朋友可以參考下2015-06-06C#實現(xiàn)輸入10個數(shù)存入到數(shù)組中并求max和min及平均數(shù)的方法示例
這篇文章主要介紹了C#實現(xiàn)輸入10個數(shù)存入到數(shù)組中并求max和min及平均數(shù)的方法,涉及C#簡單數(shù)據(jù)轉(zhuǎn)換與數(shù)值運算相關(guān)操作技巧,需要的朋友可以參考下2017-07-07C#簡單讀取、改變文件的創(chuàng)建、修改及訪問時間的方法
這篇文章主要介紹了C#簡單讀取、改變文件的創(chuàng)建、修改及訪問時間的方法,涉及C#文件類SetCreationTime、SetLastWriteTime及SetLastAccessTime的相關(guān)使用技巧,需要的朋友可以參考下2015-07-07