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的更多相关文章

  1. Linq编程101例

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

  2. Linq 101 工具和源码

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

  3. 101个LINQ示例,包含几乎全部操作

    Restriction Operators Where - Simple public void Linq1() { , , , , , , , , , }; var lowNums = from n ...

  4. LINQ 101——约束、投影、排序

    什么是LINQ:LINQ 是一组 .NET Framework 扩展模块集合,内含语言集成查询.集合以及转换操作.它使用查询的本机语言语法来扩展 C# 和 Visual Basic,并提供利用这些功能 ...

  5. Linq101-Join

    using System; using System.Collections.Generic; using System.Linq; namespace Linq101 { internal clas ...

  6. Linq101-QueryExecution

    using System; using System.Linq; namespace Linq101 { class QueryExecution { /// <summary> /// ...

  7. Linq101-Miscellaneous

    using System; using System.Collections.Generic; using System.Linq; namespace Linq101 { class Miscell ...

  8. Linq101-Aggregate

    using System; using System.Collections.Generic; using System.Linq; namespace Linq101 { class Aggrega ...

  9. Linq101-Quantifiers

    using System; using System.Collections.Generic; using System.Linq; namespace Linq101 { class Quantif ...

随机推荐

  1. golang 性能

    服务器: 阿里云ECS:1核1G内存,CentOS6.5 x64 返回内容: {"ErrInfo":{"ErrCode":0,"ErrMsg" ...

  2. BZOJ 1014 火星人prefix

    Description 火星人最近研究了一种操作:求一个字串两个后缀的公共前缀.比方说,有这样一个字符串:madamimadam,我们将这个字符串的各个字符予以标号:序号: 1 2 3 4 5 6 7 ...

  3. couchdb and redis

    http://www.jdon.com/artichect/scalable5.html http://www.dedecms.com/knowledge/data-base/nosql/2012/0 ...

  4. Javascript Framework Scenario

    Mobile----- zepto, jQuery Scroll------ iscrollhttp://cubiq.org/iscroll-4 jo.js widget----- jquery pl ...

  5. 我的VSTO之路:序

    原文:我的VSTO之路:序 VSTO是微软提供给.Net开发人员的一个接口,通过他我们可以对Office程序做一些处理.但是这个接口并不尽善尽美,相比微软的很多其他产品,VSTO的稳定性并不好,相关的 ...

  6. div大小如何改变设置

    如果改变更改div大小尺寸. 首先我们要知道DIV大小是由高和宽确定,要修改DIV容积大小我们设置css宽度和css高度即可实现改变DIV盒子大小. 一.改变div大小实例 为了实验便于观察DIV盒子 ...

  7. mangos搭建

    github地址:https://github.com/mangos/MaNGOS MaNGOS 是( Massive Network Game Object Server) 的缩写.由于暴雪公司对类 ...

  8. mysql中的group_concat函数的用法

    本文通过实例介绍了MySQL中的group_concat函数的使用方法,比如select group_concat(name) . MySQL中group_concat函数 完整的语法如下: grou ...

  9. Lucky and Good Months by Gregorian Calendar(模拟)

    http://poj.org/problem?id=3393 好大的一道模拟题,直接当阅读理解看了.下面是大神写的题意,解释的好详细. 定义: Goog month : 该月第一个工作日为星期一的月份 ...

  10. ubuntu下新建VPN连接

    1. 安装VPN Client#sudo apt-get install pptp-linux2. 安装网络管理器对VPN的支持#sudo apt-get install network-manage ...