How to read embedded resource text file

前端 未结 22 2381
悲&欢浪女
悲&欢浪女 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条回答
  •  误落风尘
    2020-11-21 06:53

    When you added the file to the resources, you should select its Access Modifiers as public than you can make something like following.

    byte[] clistAsByteArray = Properties.Resources.CLIST01;
    

    CLIST01 is the name of the embedded file.

    Actually you can go to the resources.Designer.cs and see what is the name of the getter.

提交回复
热议问题