开发者

Using variables in VisualStudio Application settings

开发者 https://www.devze.com 2023-01-12 10:11 出处:网络
i have this little problem, i use the Application settings in VS 2010 to configure a path. now it would be convenien开发者_开发知识库t if i could add a variable there (its an argument) so it looks lik

i have this little problem, i use the Application settings in VS 2010 to configure a path. now it would be convenien开发者_开发知识库t if i could add a variable there (its an argument) so it looks like this: C:\EXAMPLEDIR\... is there any way todo this? Or should i change the settings at startup in code? is this even possible (i would like to avoid this).

thank you.

GuyFawkes.


You can also change the scope from Application to User. User settings can be modified at runtime. They are saved if/when you invoke the Save method.


I solved this by creating a method that catches the setting. For example SPECIALFOLDER\Subdir... and then replaces the SPECIALFOLDER with an Environment.SpecialFolder. Voila. Now i can e.g. access the system folder in NT, XP and 7. Plus i can add more custom MY VARIABLE items to replace them accordingly.

greetings

0

精彩评论

暂无评论...
验证码 换一张
取 消