using System;
using System.Linq; namespace Linq101
{
class QueryExecution
{
/// <summary>
/// The following sample shows how query execution is deferred until the query is enumerated at a foreach statement.
/// </summary>
public void Linq99()
{
int[] numbers = new int[] { , , , , , , , , , }; int i = ; //延迟执行
var q = from n in numbers select ++i; foreach (int n in q)
{
Console.WriteLine("n={0},i={1}", n, i);
}
} /// <summary>
/// The following sample shows how queries can be executed immediately with operators such as ToList().
/// </summary>
public void Linq100()
{
int[] numbers = new int[] { , , , , , , , , , }; int i = ; //ToList->立即执行
var q = (from n in numbers select ++i).ToList(); foreach (int n in q)
{
Console.WriteLine("n={0},i={1}", n, i);
}
} /// <summary>
/// The following sample shows how, because of deferred execution, queries can be used again after data changes and will then operate on the new data.
/// </summary>
public void Linq101()
{
int[] numbers = { , , , , , , , , , }; //可重用
var lowNumbers = from n in numbers
where n <=
select n; Console.WriteLine("First run numbers <=3:");
foreach (int number in lowNumbers)
{
Console.WriteLine(number);
} lowNumbers = (from n in numbers select -n).ToArray(); Console.WriteLine("Second run numbers <=3:");
foreach (int number in lowNumbers)
{
Console.WriteLine(number);
}
}
}
}

Linq101-QueryExecution的更多相关文章

  1. (十三)数据库查询处理之QueryExecution(2)

    (十三)数据库查询处理之QueryExecution(2) 实验室这一周真的忙爆(虽然都是各种打杂的活)所以拖了很久终于在周末(摸鱼)把实验3做完了.同时准备把和查询这一块有关的博客补一下.然后就进入 ...

  2. Linq编程101例

    原文地址:101 LINQ Samples in C# Part1 - Restriction Operators Part2 - Projection Operators Part3 - Parti ...

  3. spark dataframe unionall

    今天本来想写一个spark dataframe unionall的demo,由于粗心报下面错误: Exception in thread "main" org.apache.spa ...

  4. spark on yarn 提交任务出错

    Application ID is application_1481285758114_422243, trackingURL: http://***:4040Exception in thread ...

  5. Spark入门实战系列--6.SparkSQL(中)--深入了解SparkSQL运行计划及调优

    [注]该系列文章以及使用到安装包/测试数据 可以在<倾情大奉送--Spark入门实战系列>获取 1.1  运行环境说明 1.1.1 硬软件环境 线程,主频2.2G,10G内存 l  虚拟软 ...

  6. Linq 101 工具和源码

    工具如图: 源码: https://git.oschina.net/yudaming/Linq101

  7. Jena语义Web开发101

    2015/05/28更新 代码在 https://github.com/zhoujiagen/semanticWebTutorialUsingJena 前言 该手册参考和扩展“Hebeler J, F ...

  8. Jena TDB 101 Java API without Assembler

    Update on 2015/05/12 ongoing tutorials site on https://github.com/zhoujiagen/semanticWebTutorialUsin ...

  9. Jena Fuseki 101

    前言 正如其承诺的那样 Expose your triples as a SPARQL end-point accessible over HTTP. Fuseki provides REST-sty ...

随机推荐

  1. 为什么要用专业的ETL

    这两天一直在思考一个问题,为什么要用专业的etl工具进行数据清洗,原因如下: ETL负责将分布的.异构数据源中的数据如关系数据.平面数据文件等抽取到临时中间层后进行清洗.转换.集成,最后加载到数据仓库 ...

  2. [BZOJ 1303] [CQOI2009] 中位数图 【0.0】

    题目链接:BZOJ - 1303 题目分析 首先,找到 b 的位置 Pos, 然后将数列中小于 b 的值赋为 -1 ,大于 b 的值赋为 1 . 从 b 向左扩展,不断算 Sum[i, b - 1] ...

  3. 2014年Facebook的开源成就

    2014是Facebook开源硕果丰硕的一年,其开源项目经理詹姆斯·皮尔斯(James Pearce)连续12天发布开源博客文章展示全年该社交网站在此领域取得的成就. 皮尔斯公布的成就包括以下内容: ...

  4. OpenSource.com 评出 2014 年十佳开源软件

    Docker 应用容器平台 “电源管理和虚拟化以相同的方式允许我们从服务器利用率中获取最大的利益.如何真正的解决虚拟化,这世界第一难题仍然是普遍存在的.Docker 自从 2013 年开源以来,刚好在 ...

  5. Unity3d Material(材质) 无缝拼接

    Unity3d Material(材质) Edit by @灰太龙 在做一个项目的过程中,遇到动态切换壁纸的功能,问题点在无缝拼接! 那我们先查查Unity3d 中的材质球,里面有个参数 Tiling ...

  6. Children of the Candy Corn

    poj3083:http://poj.org/problem?id=3083 题意:给你一个迷宫,然后给你一个起点和终点,现在给你种规则,一种是先向左,无法向左则向前,无法向前则向右,否则则向后,另外 ...

  7. [Mon Feb 10 15:21:06 2014] [notice] child pid 7101 exit signal File size limit exceeded (25)

    今天遇到的问题: LAMP的LOG里报如下错误. 然后IE和FIREFOX里显示连接被重置或是无法访问. 但自己建一个正常的PHP测试探针倒可以. 原来是PHP错误日志太多,无法写入LOG导致. [r ...

  8. Strange Way to Express Integers (一般模线性方程组)

    Time Limit: 1000MS   Memory Limit: 131072K Total Submissions: 8476   Accepted: 2554 Description Elin ...

  9. 数据结构——foodfill 八连块问题

    Description Due to recent rains, water has pooled in various places in Farmer John's field, which is ...

  10. 80 多个 Linux 系统管理员的监控工具

    原文出处: serverdensity   译文出处:Linux中国 随着互联网行业的不断发展,各种监控工具多得不可胜数.这里列出网上最全的监控工具.让你可以拥有超过80种方式来管理你的机器.在本文中 ...