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. 正则表达式:根据逗号解析CSV并忽略引号内的逗号

    需求:解析CSV文件并忽略引号内的逗号 解决方案: public static void main(String[] args) { String s = "a,b,c,\"1,0 ...

  2. Arbitrage

    Description Arbitrage is the use of discrepancies in currency exchange rates to transform one unit o ...

  3. VS2010安装Visual Assist

    Visual Assist X是一款非常好的Microsoft Visual Studio 2005和Visual Studio .NET插件,支持C/C++,C#,ASP,Visual Basic, ...

  4. 日志式文件系统:SGI的xfs, Reiserfs, IBM的jfs, ext3fs

    日志文件(Log files)是包含系统消息的文件,包括内核.服务.在系统上运行的应用程序等.不同的日志文件记载不同的信息.日志文件系统比传统的文件系统安全,因为它用独立的日志文件跟踪磁盘内容的变化. ...

  5. parted命令分区

    http://soft.chinabyte.com/os/447/12439447.shtml http://blog.163.com/warking_xp/blog/static/103910320 ...

  6. Channel Allocation(四色定理 dfs)

    Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 10897   Accepted: 5594 Description When ...

  7. COJ 2110 Day7-例3

    Day7-例3 难度级别:C: 运行时间限制:5000ms: 运行空间限制:256000KB: 代码长度限制:2000000B 试题描述 输入 输入的第一行包含整数n和k,其中n(2 ≤ n ≤100 ...

  8. MongoDB 任意代码执行漏洞(CVE-2013-4142)

    漏洞版本: MongoDB 2.4.0-2.4.4 漏洞描述: CVE ID:CVE-2013-4142 MongoDB是一个高性能,开源,无模式的文档型数据库,是当前NoSql数据库中比较热门的一种 ...

  9. 汇编学习笔记(3)[bx]和loop

    本文是<汇编语言>一书的学习笔记,对应书中的4-6章. 汇编程序的执行 要想将源代码变为可执行的程序需经过编译.连接两个步骤,WIN7操作系统下需要MASM程序来进行编译连接工作.将MAS ...

  10. HDOJ 2027 统计元音

    Problem Description 统计每个元音字母在字符串中出现的次数. Input 输入数据首先包括一个整数n,表示测试实例的个数,然后是n行长度不超过100的字符串. Output 对于每个 ...