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

前端 未结 7 1176

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:53

    Not sure what you mean by "efficient" in this context, but I'd use System.IO.File.WriteAllBytes(string path, byte[] bytes) - Certainly efficient in terms of LOC.

提交回复
热议问题