我得到了错误var ts = System.Threading.ThreadStart(delegate()
(红线淹没在下面System.Threading.ThreadStart
)。问题是什么?
using System;
using System.Threading;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
public Program()
{
int[] iArray = new int[3];
iArray[0] = 2;
iArray[1] = 1;
iArray[2] = 5;
var ts = System.Threading.ThreadStart(delegate()
{
foreach (int i in iArray)
Foo(i);
});
}
public void Foo(int i)
{
Console.WriteLine(i + ",");
}
public static void Main(String[] args)
{
Program p = new Program();
}
}
}