您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
25 行
834 B
25 行
834 B
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
|
|
namespace UnityEditor.Graphing.Util
|
|
{
|
|
public static class EnumerableExtensions
|
|
{
|
|
public static IEnumerable<TResult> Zip<TFirst, TSecond, TResult>(this IEnumerable<TFirst> first, IEnumerable<TSecond> second, Func<TFirst, TSecond, TResult> resultSelector)
|
|
{
|
|
var e1 = first.GetEnumerator();
|
|
var e2 = second.GetEnumerator();
|
|
|
|
while (e1.MoveNext() && e2.MoveNext())
|
|
{
|
|
yield return resultSelector(e1.Current, e2.Current);
|
|
}
|
|
}
|
|
|
|
public static IEnumerable<ValueTuple<TFirst, TSecond>> Zip<TFirst, TSecond>(this IEnumerable<TFirst> first, IEnumerable<TSecond> second)
|
|
{
|
|
return first.Zip(second, ValueTuple.Create);
|
|
}
|
|
}
|
|
}
|