这是我的代码:
protected void Button1_Click(object sender, EventArgs e)
{
Timer1.Enabled = true;
}
int _ta = 0;
protected void Timer1_Tick(object sender, EventArgs e)
{
if (_ta < 1)
{
_ta++;
System.Diagnostics.Debug.WriteLine(_ta);
}
但是WriteLine(_ta);
1 次后并没有停止,它只是继续。为什么?怎样才能达到这种效果?
编辑:
对不起,我不够清楚:
我的意思是:
System.Diagnostics.Debug.WriteLine(_ta);
这仍然会发生,即使 _ta 大于 0。