C#使用linq查询大数据集的方法
作者:令狐不聪 时间:2023-05-24 16:52:17
本文实例讲述了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#,linq,查询
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Android自定义View实现炫酷进度条
2023-09-22 00:16:07
![](https://img.aspxhome.com/file/2023/3/126753_0s.jpg)
java简单实现多线程及线程池实例详解
2023-05-12 05:47:04
C# winform点击生成二维码实例代码
2023-12-10 08:17:20
![](https://img.aspxhome.com/file/2023/8/106418_0s.png)
Android使用友盟集成QQ、微信、微博等第三方分享与登录方法详解
2022-03-07 01:46:30
![](https://img.aspxhome.com/file/2023/6/137966_0s.png)
Android实现图片在屏幕内缩放和移动效果
2021-10-28 12:24:57
![](https://img.aspxhome.com/file/2023/9/96809_0s.gif)
c# 圆形识别方案和直线识别方案的参考示例
2022-03-10 13:44:11
![](https://img.aspxhome.com/file/2023/4/116654_0s.png)
Spring Security内置过滤器的维护方法
2022-07-30 18:10:16
![](https://img.aspxhome.com/file/2023/5/61285_0s.jpg)
Android SQLite详解及示例代码
2023-08-04 22:26:35
![](https://img.aspxhome.com/file/2023/3/84753_0s.png)
Kotlin协程Dispatchers原理示例详解
2022-09-26 00:09:45
Struts2拦截器登录验证实例
2021-10-26 06:47:04
![](https://img.aspxhome.com/file/2023/5/84185_0s.png)
解决ThingsBoard编译报错问题:Failure to find org.gradle:gradle-tooling-api:jar:6.3
2021-11-20 16:24:22
![](https://img.aspxhome.com/file/2023/7/62117_0s.png)
如何实现java Iterator迭代器功能
2023-10-14 14:30:49
![](https://img.aspxhome.com/file/2023/8/78058_0s.png)
C++数组指针和二维数组详情
2022-03-31 21:11:07
![](https://img.aspxhome.com/file/2023/3/127513_0s.png)
Android判断是否为飞行模式简单方法
2021-06-03 20:02:14
Android实现极简打开摄像头
2022-09-10 15:56:51
![](https://img.aspxhome.com/file/2023/2/96802_0s.jpg)
scala 读取txt文件的方法示例
2022-09-30 19:21:10
![](https://img.aspxhome.com/file/2023/3/75493_0s.png)
C#中txt数据写入的几种常见方法
2022-01-14 01:25:47
获取Android手机中所有短信的实现代码
2023-08-04 16:55:30
Java如何使用HTTPclient访问url获得数据
2023-11-12 04:16:21
Java设计模式之共享模式/享元模式(Flyweight模式)介绍
2023-06-15 04:35:10