What is the shortest way to get the string content of a HttpPostedFile in C#

ぃ、小莉子 提交于 2019-12-04 16:04:10

问题


I have an HttpPostedFile object and just need to extract the content of the posted file.

I found this link but that's a very long process to just obtain a string with the content.

Is there any shorter way? (Preferably, a one line instruction.)


回答1:


var str = new StreamReader(postedFile.InputStream).ReadToEnd();

StreamReader.ReadToEnd



来源:https://stackoverflow.com/questions/10344449/what-is-the-shortest-way-to-get-the-string-content-of-a-httppostedfile-in-c-shar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!