How to download memorystream to a file?

前端 未结 4 2000
半阙折子戏
半阙折子戏 2020-12-10 04:04

I\'m using the below sample code for writing and downloading a memory stream to a file in C#.

MemoryStream memoryStream = new MemoryStream();
TextWriter tex         


        
4条回答
  •  感动是毒
    2020-12-10 04:21

    You're using a very long way to convert string to bytes.
    Are you sure, that you need any streams? Why just don't use encoding?

    Response.BinaryWrite(Encoding.UTF8.GetBytes("Something"))

提交回复
热议问题