creating file from returned byte array via WCF Rest Service
I am working on creating a WCF rest service. I have a function that will return a byte array of a file 开发者_高级运维created by the service. I was wondering how I can create this file, from the byte array on the client side. This is in C#.
Simply write all received bytes to the file:
File.WriteAllBytes("filename.bin", receivedBytesArray);
Save stream to file:
Stream receivedStream = // do some staff to receive stream
using (FileStream stream = File.OpenWrite("myfilepath.bin"))
{
receivedStream.CopyTo(stream);
}
精彩评论