DCSIMG
Application Configuration Continued – .Settings file - מקודד לשווא

Application Configuration Continued – .Settings file

Another method to use configuration is the .settings file .

step 1. add new item to your project , select category general , and setting file template.

set the name of the setting file, it will also be the name of your setting class.

 

What you get is a .settings file , and a .cs file , which implies that you’ll have a programmatic API as well.

 

step 2. let’s add a test setting , i added a HomeDir  setting with the value of c:\temp\ we will ignore the rest of the options for now

 

step 3.  let’s compile the application.

what we can see is that we have a .exe.config file , though we didn’t add an application configuration file.

let’s open the configuration file, we see that one of the products is a configuration that can be edited just like in <appSettings></appSettings>

step 4.  how do I access the setting via code ?

well it’s quite simple just write  AppConfig.Default.HomeDir  and that’s that.

sc1

conclusions – it’s a simple mechanism provided by the IDE that support configuration with complex types.

next time I’ll get into some more features of the settings file.

enjoy.

Published Wednesday, February 25, 2009 7:58 PM על ידי danielisimo

תוכן התגובה

# re: Application Configuration Continued – .Settings file

Sunday, May 17, 2009 9:38 PM על ידי nick_eltrel

www.message_ladomcac.com

שלח תגובה

(שדה חובה) 
(שדה חובה) 
(אופציונלי)
(שדה חובה) 

Enter the numbers above:
Powered by Community Server (Commercial Edition), by Telligent Systems