您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

41 行
976 B

using System;
using System.Collections.Generic;
namespace RSG.Promises
{
/// <summary>
/// General extensions to LINQ.
/// </summary>
public static class EnumerableExt
{
public static void Each<T>(this IEnumerable<T> source, Action<T> fn)
{
foreach (var item in source)
{
fn.Invoke(item);
}
}
public static void Each<T>(this IEnumerable<T> source, Action<T, int> fn)
{
int index = 0;
foreach (T item in source)
{
fn.Invoke(item, index);
index++;
}
}
/// <summary>
/// Convert a variable length argument list of items to an enumerable.
/// </summary>
public static IEnumerable<T> FromItems<T>(params T[] items)
{
foreach (var item in items)
{
yield return item;
}
}
}
}