c# - Access to Resources -
i've c# project , has resources folder. folder has of txt files. files have various file names.
i'm taking file names source string variable. example have filename string variable , test.txt file in resources folder:
string filename = "test.txt"; when want access file below, can:
wpfapplication.properties.test.txt; but, when want access code, can't.
wpfapplication.properties.filename; i want use filename string variable , access text file.
what can access it?
thanks in advance.
edit : change form of question: i've string variable assigned text file name. example; have a.txt, b.txt, c.txt, d.txt, etc.. i'm taking file name string variable (filename) via loops. so, took "c.txt" string. and, can access file code in below:
textname = "c.txt"; filename = "../../resources\\" + textname; however, when build project setup project , install .exe file pc, there no "resources" folder in application's folder. so,
../../resources\
is unavailable.
how can access resources folder exe file's folder?
you need add resource file project wich has extension .resx/.aspx.resx. able double click on file , edit required resources/resource strings. right click on project node in solution explorer > add > new item > resource file. let assume have added file called resourcestrings.resx properties folder , added resource string key name myresourcestring, access these strings
string s = properties.resourcestrings.myresourcestring; i hope helps.
Comments
Post a Comment