Linq101-CustomSequence
using System;
using System.Collections.Generic;
using System.Linq; namespace Linq101
{
class CustomSequence
{
public void Linq98()
{
int[] vectorA = { , , , , };
int[] vectorB = { , , , , }; int result = vectorA.Combine(vectorB, (a, b) => a * b).Sum();
Console.WriteLine(result);
}
} public static class CustomSequenceOperators
{
public static IEnumerable<int> Combine(this IEnumerable<int> first, IEnumerable<int> second, Func<int, int, int> func)
{
//List<int> list=new List<int>();
using (IEnumerator<int> e1 = first.GetEnumerator(), e2 = second.GetEnumerator())
{
while (e1.MoveNext() && e2.MoveNext())
{
yield return func(e1.Current, e2.Current);
//list.Add(func(e1.Current, e2.Current));
}
}
//return list;
}
}
}
Linq101-CustomSequence的更多相关文章
- Linq编程101例
原文地址:101 LINQ Samples in C# Part1 - Restriction Operators Part2 - Projection Operators Part3 - Parti ...
- Linq 101 工具和源码
工具如图: 源码: https://git.oschina.net/yudaming/Linq101
- 101个LINQ示例,包含几乎全部操作
Restriction Operators Where - Simple public void Linq1() { , , , , , , , , , }; var lowNums = from n ...
- LINQ 101——约束、投影、排序
什么是LINQ:LINQ 是一组 .NET Framework 扩展模块集合,内含语言集成查询.集合以及转换操作.它使用查询的本机语言语法来扩展 C# 和 Visual Basic,并提供利用这些功能 ...
- Linq101-Join
using System; using System.Collections.Generic; using System.Linq; namespace Linq101 { internal clas ...
- Linq101-QueryExecution
using System; using System.Linq; namespace Linq101 { class QueryExecution { /// <summary> /// ...
- Linq101-Miscellaneous
using System; using System.Collections.Generic; using System.Linq; namespace Linq101 { class Miscell ...
- Linq101-Aggregate
using System; using System.Collections.Generic; using System.Linq; namespace Linq101 { class Aggrega ...
- Linq101-Quantifiers
using System; using System.Collections.Generic; using System.Linq; namespace Linq101 { class Quantif ...
随机推荐
- 【RabbitMQ】 Routing
Routing 之前的章节里我们构建了一个简单的日志系统.我们可以广播所有的日志消息给所有的接收端. 本节我们将给它添加一个新特性 - 我们将允许只订阅一个消息的子集.例如,我们只将关键的错误消息定位 ...
- ExtJs3常用控件操作实例
结合工作内容,不定期更新.这里面可能会讲到一些常用的组件的操作. json: { "total": 30, "data": [{ "funcAlign ...
- .NET EntityFramework
http://www.cnblogs.com/lsxqw2004/archive/2009/05/31/1495240.html http://www.cnblogs.com/flowwind/p/3 ...
- Inno Setup安装时不能关闭指定进程
脚本由 Inno Setup 脚本向导 生成!; 有关创建 Inno Setup 脚本文件的详细资料请查阅帮助文档! #define MyAppName "XX管理系统"#defi ...
- fedora下体验gentoo安装
服务器上安装了fedora,但是对gentoo很想体验一番,没有新机器,不想重装系统,所以只能chroot来体验getoo了. 下载portage-20130817.tar.bz2和stage3-am ...
- ZKW费用流修正
#include<iostream> #include<cstdio> #include<cmath> #include<algorithm> #inc ...
- 贪心 BZOJ 3671:[Noi2014]随机数生成器
Description Input 第 1行包含5个整数,依次为 x_0,a,b,c,d ,描述小H采用的随机数生成算法所需的随机种子.第2行包含三个整数 N,M,Q ,表示小H希望生成一个1到 ...
- select的使用(二)
多表查询 /*基本连接*/ select a.Name,b.Name from T_Employee a,T_Department b where a.DepartmentId=b.Id /*内连接, ...
- 光学字符识别OCR
1.功能: 光学字符识别(OCR,Optical Character Recognition)是指对文本资料进行扫描,然后对图像文件进行分析处理,获取文字及版面信息的过程 2.典型应用: 名片扫描 3 ...
- FZYZOJ-1880 【UFO】水管
P1880 -- [ufo]水管 时间限制:1000MS 内存限制:131072KB 通过/提交人数:32/100 状态: 标签: 数学问题-组合数学 无 ...