int k=1000;
string str1="40M497AB2";
string str2="4B";
for(int i=0;i<1000;i++)
{
string str3=str1+k.ToString()+str2;
console.writeLine(str3);
k++;
}
运行结果为
40M497AB210004B
40M497AB210024B
40M497AB210034B
40M497AB210044B
40M497AB210054B
40M497AB210064B
40M497AB210074B
40M497AB210084B
40M497AB210094B
40M497AB210104B
40M497AB210114B
40M497AB210124B
40M497AB210134B
40M497AB210144B
40M497AB210154B
40M497AB210164B
。
但是,意外出现了
运行结果其中会有一段为
40M497AB211514B
40M497AB211524B
40M497AB211534B
40M497AB211544B
40M497AB211554B
40M497AB211565B
40M497AB211566B
40M497AB211567B
40M497AB211568B
40M497AB211569B
40M497AB211570B
40M497AB211571B
40M497AB211572B
40M497AB211573B
。
之后又跳回正常了
string str1="40M497AB2";
string str2="4B";
for(int i=0;i<1000;i++)
{
string str3=str1+k.ToString()+str2;
console.writeLine(str3);
k++;
}
运行结果为
40M497AB210004B
40M497AB210024B
40M497AB210034B
40M497AB210044B
40M497AB210054B
40M497AB210064B
40M497AB210074B
40M497AB210084B
40M497AB210094B
40M497AB210104B
40M497AB210114B
40M497AB210124B
40M497AB210134B
40M497AB210144B
40M497AB210154B
40M497AB210164B
。
但是,意外出现了
运行结果其中会有一段为
40M497AB211514B
40M497AB211524B
40M497AB211534B
40M497AB211544B
40M497AB211554B
40M497AB211565B
40M497AB211566B
40M497AB211567B
40M497AB211568B
40M497AB211569B
40M497AB211570B
40M497AB211571B
40M497AB211572B
40M497AB211573B
。
之后又跳回正常了
比較類似的問題就是在後臺頁面動態的按鈕註冊事件的時候如果在PageLoad裏面調用過你不追斷點的時候, 取值的時候就會比你點的慢一步。但如果Debug的話,就不會有問題了建議你看下這段代碼調用的次數和位置