在c#线程中,调用的方法具有参数,则下面代码中t1.start前面的那句话该怎么改呢?
namespaceConsoleApplication1{classProgram{staticpublicvoidproc1(intn){intsum=0;for(in...
namespace ConsoleApplication1
{
class Program
{
static public void proc1(int n)
{
int sum = 0;
for (int i = 0; i < n; i++)
{
sum += n;
}
Console.WriteLine("t1 startde");
Console.WriteLine(sum);
}
static int Main(string[] args)
{
Thread t1 = new Thread(new ThreadStart(proc1(int n)));
t1.Start();
}
}
} 展开
{
class Program
{
static public void proc1(int n)
{
int sum = 0;
for (int i = 0; i < n; i++)
{
sum += n;
}
Console.WriteLine("t1 startde");
Console.WriteLine(sum);
}
static int Main(string[] args)
{
Thread t1 = new Thread(new ThreadStart(proc1(int n)));
t1.Start();
}
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询