How to write super-fast file-streaming code in C#?

后端 未结 9 1926
遥遥无期
遥遥无期 2020-11-28 19:11

I have to split a huge file into many smaller files. Each of the destination files is defined by an offset and length as the number of bytes. I\'m using the following code:<

9条回答
  •  广开言路
    2020-11-28 19:47

    The fastest way to do file I/O from C# is to use the Windows ReadFile and WriteFile functions. I have written a C# class that encapsulates this capability as well as a benchmarking program that looks at differnet I/O methods, including BinaryReader and BinaryWriter. See my blog post at:

    http://designingefficientsoftware.wordpress.com/2011/03/03/efficient-file-io-from-csharp/

提交回复
热议问题