using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace LearnThread
{
class Delay
{
public int timePass()
{
static int i=0;
for(i=0; i<100;i++)
{
Thread.Sleep(1000);
}
return i;
}
}
}
Error:The modifier 'static' is not valid for this item靜態INT
爲什麼靜態是錯誤嗎?我們不能在int語言中使用static,因爲我們可以在C語言中使用它?
因爲C#是不是C. – leppie 2012-03-20 12:58:57
你怎麼能指望一個實例方法的靜態局部變量_inside_表現? – David 2012-03-20 12:59:25
另外,無論如何,「我」在那裏靜態有什麼意義? – Matthew 2012-03-20 13:18:50