What is the most efficient way to save a byte array as a file on disk in C#?

前端 未结 7 1341

Pretty simple scenario. I have a web service that receives a byte array that is to be saved as a particular file type on disk. What is the most efficient way to do this in C#?

7条回答
  •  忘掉有多难
    2021-02-06 20:45

    Perhaps the System.IO.BinaryWriter and BinaryReader classes would help.

    http://msdn.microsoft.com/en-us/library/system.io.binarywriter.aspx

    "Writes primitive types in binary to a stream and supports writing strings in a specific encoding."

    http://msdn.microsoft.com/en-us/library/system.io.binaryreader.aspx

    "Reads primitive data types as binary values in a specific encoding."

提交回复
热议问题