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. jQuery Ajax 分页插件

    很多社交网站都使用无限滚动的翻页技术来提高用户体验,当你页面滑到列表底部时候无需点击就自动加载更多的内容 很多社交网站都使用无限滚动的翻页技术来提高用户体验,当你页面滑到列表底部时候无需点击就自动加载 ...

  2. Grails架设和配置--起步

    现在作这些配置有些轻车熟路了.. 因为RAILS ON RUBY和它真的有很多相像的,, 什么DRY,什么约定先于配置这些的概念... 然后,GITHUB上有好文档,可以一步一步的实践.. https ...

  3. github上值得研究的项目和人

    https://github.com/Dax89?tab=repositories https://github.com/stars/gabrielcorado https://github.com/ ...

  4. Unity NGUI根据高度自适应屏幕分辨率

    Unity版本:4.5.1 NGUI版本:3.6.5 本文内容纯粹转载,转载保留参考链接和作者 参考链接:http://blog.csdn.net/asd237241291/article/detai ...

  5. phpMyAdmin 完整路径泄露漏洞

    漏洞名称: phpMyAdmin 完整路径泄露漏洞 CNNVD编号: CNNVD-201307-650 发布时间: 2013-08-09 更新时间: 2013-08-09 危害等级: 中危   漏洞类 ...

  6. WordPress Pie Register插件‘wp-login.php’多个跨站脚本漏洞

    漏洞名称: WordPress Pie Register插件‘wp-login.php’多个跨站脚本漏洞 CNNVD编号: CNNVD-201307-255 发布时间: 2013-07-31 更新时间 ...

  7. -_-#【Mac】MacVim

    MacVim安装与配置 Mac开发利器之程序员编辑器MacVim学习总结 Git时代的VIM不完全使用教程 zencoding-vim This repository has moved to htt ...

  8. wpa_cli与wpa_supplicant的交互命令

    1)通过adb命令行,可以直接打开supplicant,从而运行wpa_cli,可以解决客户没有显示屏而无法操作WIFI的问题,还可以避免UI的问题带到driver.进一步来说,可以用在很多没有键盘输 ...

  9. 【Android Studio】没有先安装JDK

    如果没有先安装JDK,安装Android Studio的时候回出现下面这个界面: 请参考我整理的博客文章<JDK的下载.安装和配置>,链接:http://www.cnblogs.com/d ...

  10. C++中delete和 delete[]的区别

    总的原则是,如果是用new[]创建的,则用delete[]删除,如果是用new创建的,则用delete删除. 对于基本类型,比如char *p=new char[20];如果删除时,delete p和 ...