这个函数在 WinForm程序中用,VS下DEBUG模式运行程序就飞掉。送分的,能解释更好!
serf 2018-12-11 04:27:09 static public void Test()
{
byte[] test = new byte[100];
test[0] = 0x31;
test[1] = 0x32;
string strTemp = System.Text.Encoding.ASCII.GetString(test, 0, 100);
for (int i = 0; i < 100; i++)
{
//Debug.Write(strTemp);
System.Console.WriteLine(strTemp);
}
}
此时strTemp中后面会有一堆0。
WinForm中调用单步跟踪和直接运行效果是不一样的。如果在console程序中,一切正常。似乎VS的输出窗口与system.console输出的连接上有问题。
换成Debug.Write输出,是正常的。