How to read a text file in project's root directory?

前端 未结 7 782
走了就别回头了
走了就别回头了 2020-12-04 10:45

I want to read the first line of a text file that I added to the root directory of my project. Meaning, my solution explorer is showing the .txt file along side my .cs files

相关标签:
7条回答
  • 2020-12-04 11:28

    Add a Resource File to your project (Right Click Project->Properties->Resources). Where it says "strings", you can switch to be "files". Choose "Add Resource" and select your file.

    You can now reference your file through the Properties.Resources collection.

    0 讨论(0)
提交回复
热议问题