How to read embedded resource text file

前端 未结 22 2408
悲&欢浪女
悲&欢浪女 2020-11-21 06:03

How do I read an embedded resource (text file) using StreamReader and return it as a string? My current script uses a Windows form and textbox that allows the

22条回答
  •  闹比i
    闹比i (楼主)
    2020-11-21 06:39

    The answer is quite simple, simply do this if you added the file directly from the resources.resx.

    string textInResourceFile = fileNameSpace.Properties.Resources.fileName;
    

    With that line of code, the text from the file is directly read from the file and put into the string variable.

提交回复
热议问题