Creating a Huge Dummy File in a Matter of Seconds in C#

后端 未结 5 483
梦如初夏
梦如初夏 2020-12-04 21:43

I want to create a huge dummy file say 1~2 GBs in matter of seconds. here is what I\'ve written in C# :

file.writeallbytes(\"filename\",new byte[a huge numbe         


        
5条回答
  •  天涯浪人
    2020-12-04 22:21

    I could be wrong but you will probably find that it's impossible to create a file that large that quickly as there will be a bottleneck in the I/O writing process.

    However in your code above the Applciation.DoEvents will be slowing things down. Also any repainting of the screenthis.label2.Text = will cause a slight slow down.

提交回复
热议问题