Reputation: 23
Here, vaccineFiles.txt is the file, I want to access from marked class file named validators.cs. It is marked in blue. What is the proper way to access the file?
Upvotes: 0
Views: 72
Reputation: 21
My first recommendation is that if validator.cs is not a controller, it´s better to move it outside Controllers folder. With "AppDomain.CurrentDomain.BaseDirectory" you can get base directory for your execution base path. Another consideration is to set "Copy to output directory" to "Copy always" or "Copy if newer" under properties (F4) for vaccineFiles.txt in order the file to be copied to bin folder after building it.
I hope it could be helpful for you.
BR!
Upvotes: 1