// @nuget: FluentAssertions
using System;
namespace Try_More_On_IEnumerable
{
class Program
static void Main(string[] args)
T04Linq产生数值.Run();
Console.WriteLine($"运行成功,{DateTime.Now:O}");
}
using System.Linq;
using FluentAssertions;
public class T04Linq产生数值
public static void Run()
// 系统内置了一个方法来获取数字的自增序列,因此可以如此简化
var result = Enumerable
.Range(0, 11)
.Where(x => x % 2 == 0);
result.Should().Equal(0, 2, 4, 6, 8, 10);