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. getClassInstances --通过类的实例来得到数据

    好东西,空了来研究 实例代码如下: for b in getClassInstances bitmaptex doformat "Name : %, Texture name : %, Af ...

  2. wlan的QOS配置

    WLAN QoS配置 1.1  WLAN QoS简介 802.11网络提供了基于竞争的无线接入服务,但是不同的应用需求对于网络的要求是不同的,而原始的网络不能为不同的应用提供不同质量的接入服务,所以已 ...

  3. BZOJ 3223 文艺平衡树

    Description   您需要写一种数据结构(可参考题目标题),来维护一个有序数列,其中需要提供以下操作:翻转一个区间,例如原有序序列是5 4 3 2 1,翻转区间是[2,4]的话,结果是5 2  ...

  4. WebService引擎Axis2完美教程

    1.http://wenku.baidu.com/link?url=O05r69TGaLmrJrjJqGz-5EASox8FhhUO6i97xoUOV2dcbh8BEnOlX2EN3nuYGE_3HE ...

  5. php socket 通信

    Socket扩展是基于流行的BSD sockets,实现了和socket通讯功能的底层接口,它可以和客户端一样当做一个socket服务器. 想了解更通用的客户端socket接口,请看 stream_s ...

  6. perl 定义post接口

    [root@wx03 mojo]# cat a1.pl use Digest::MD5; my $md5 = Digest::MD5->new; $md5->add(1234567); p ...

  7. Powerful Regex

    Online test Regex http://rubular.com An example src="http:\/\/localhost:3000\/preveiw-tool\/iph ...

  8. Oracle用户管理

    创建用户 概述:在oracle中要创建一个新的用户使用create user 语句,一般是具有dba(数据库管理员)的权限才能使用. create user 用户名 identified by 密码: ...

  9. 用DELPHI操作EXCEL Word

    用DELPHI操作EXCEL 在DELPHI中显示EXCEL文件,可用以下简单代码做到.但要实用,则需进一步完善. var  Form1: TForm1;  EApp:variant;implemen ...

  10. Fragmen横竖屏切换,导致页面混乱,oncreateView重复调用

    在清单文件Activity设置属性 android:screenOrientation="landscape" android:configChanges="screen ...