从0到15迭代并且打印出迭代索引号和索引号的平方。
using System;
using System.Threading.Tasks; //必须使用这个命名空间
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
Parallel.For(0, 15, i =>
Console.WriteLine("The square of {0} is {1}", i, i * i));
}
}
}