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 ...
随机推荐
- kafka笔记-Kafka在zookeeper中的存储结构【转】
参考链接:apache kafka系列之在zookeeper中存储结构 http://blog.csdn.net/lizhitao/article/details/23744675 1.topic注 ...
- GPIO软件模拟I2C
/***************************************************************************** * * Filename: * ----- ...
- curl post传递json数据
有时想在命令行使用post http提交一个表单,比较常用的是POST模式和GET模式 GET模式什么option都不用,只需要把变量写在url里面就可以了 比如:curl http://www.wa ...
- 【HDOJ】1247 Hat’s Words
字典树. #include <cstdio> #include <cstring> #include <cstdlib> #define MAXN 50005 #d ...
- MongoDB 任意代码执行漏洞(CVE-2013-4142)
漏洞版本: MongoDB 2.4.0-2.4.4 漏洞描述: CVE ID:CVE-2013-4142 MongoDB是一个高性能,开源,无模式的文档型数据库,是当前NoSql数据库中比较热门的一种 ...
- 【转】Jollen 的 Android 教學,#12: 如何建立選單 Menu
原文网址:http://www.jollen.org/blog/2009/06/jollen-android-programming-12.html Android應用程式的UI可以使用XML來定義, ...
- (转载)Mysql使用Describe命令判断字段是否存在
(转载)http://www.jz123.cn/plus/view.php?aid=39200 工作时需要取得MySQL中一个表的字段是否存在 于是就使用Describe命令来判断 mysql_con ...
- 我家用的网络IP地址给定,MAC绑定,我买了个无线路由器,请问怎么设定能让我的电脑和手机都能上网
我家用的网络IP地址给定,MAC绑定,我买了个无线路由器,请问怎么设定能让我的电脑和手机都能上网 房东给的IP地址是:192.168.1.5 255.255.255.0 192.168.1.1 2 ...
- Majority Element II——LeetCode
Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorit ...
- flex与C# Socket通信
原文地址:http://blog.csdn.net/LX10752p/archive/2011/04/27/6366526.aspx Socket 通信没什么好说,一个服务端,多个客户端,很容易搭建环 ...