开发者

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);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜