for(long i=0;i<ouput.LongLength;i++)
{
string temp2 = ouput[i].ToString("x");
hexstr += temp2 +" ";
}这样是很耗时间的hexstr += temp2 +" ";
每次都要搜索到字符串的后尾,然后才连接字符串,
而且字符串是越来越长,那么就越来越慢了
{
string temp2 = ouput[i].ToString("x");
hexstr += temp2 +" ";
}这样是很耗时间的hexstr += temp2 +" ";
每次都要搜索到字符串的后尾,然后才连接字符串,
而且字符串是越来越长,那么就越来越慢了
解决方案 »
- 求救:图片与byte[]之间转换的编码方式问题
- 求救 在线等
- C#程序,导出为word文档排版问题
- 急救!
- 请问FileDialogPermissionAccess的用法,最好有例子说明!谢谢!
- try()catch其中catch里面的代码乱套了
- 电脑开机后第一次运行自己做WINFORM程序报错,求解
- 初学级别_怎么在Microsoft Visual Studio .NET 2003编译HelloWorld
- windows media player 9.0控件怎么连续播放
- 求助,在窗体的OnPaint事件中绘图时,总是被窗体上相应位置控件遮盖,怎样才能绘制于最上层(不被所在位置的控件遮挡)?
- 为什么File.delete(文件路径)不行啊,SOS
- 这个问题如何解决?
for(long i=ouput.LongLength; i>0; i--)
{
string temp2 = ouput[i-1].ToString("x");
write = temp2 + " " + write;
}
System.DateTime t1=System.DateTime.Now;
byte[] buffer;
try
{
System.IO.Stream aFile=System.IO.File.Open(@"D:\RavBack\zip.dll",System.IO.FileMode.Open);
buffer=new byte[aFile.Length];
aFile.Read(buffer, 0, buffer.Length);
aFile.Close();
}
catch(System.IO.IOException ex)
{
string errStr = "读取数据失败:\n";
errStr += ex.Message;
MessageBox.Show(errStr);
return;
}
System.Text.StringBuilder hexstr=new System.Text.StringBuilder(buffer.Length <<1);
foreach(byte b in buffer)
hexstr.Append(b.ToString("X2"));this.richTextBox1.Text =hexstr.ToString();System.DateTime t2=System.DateTime.Now;
System.TimeSpan diff=t2.Subtract(t1);
MessageBox.Show(diff.ToString());
MessageBox.Show(hexstr.Length.ToString());