Reputation: 3
I have built a web application with vacations period planning (didactic purpose).
I need to import a text file with bank holidays once a year (the file will be uploaded in UI).
(ex: localPath/BankHolidays.txt
- contains: 1.01.2015,31.12.2015,...
).
I thought it would be a good approach to save the given text file as a Resource file instead of saving it somewhere else (in ProjectDir) as a normal .txt
file. Because I need to access this file quite often and I don't think it's necessary to save this information in a db...
Is this a really good approach in my case?
If it is, how can I save a file in Resources dynamically from my code?
Upvotes: 0
Views: 420
Reputation: 1
Have a look at the resourceWriter class on the MSDN:
http://msdn.microsoft.com/en-us/library/system.resources.resourcewriter.aspx
This class will perform all of the heavy lifting in terms of file I/O and data formatting. There is also a great tutorial on how to actually use it at:
http://www.c-sharpcorner.com/UploadFile/yougerthen/105232008045338AM/1.aspx
Upvotes: 1