This is my app.config:
<appSettings>
<add key="PreRootFolder" value="D:\" />
<add key="RootFolder" value="webSite" />
<add key="Folder" value="folder_a" />
</appSettings>
Since I prefer to build the path in the application rather than have many keys for each part of the path... (hard to maintain) so I build the path this way:
string prePath = ConfigurationManager.AppSettings["PreRootFolder"];
string rootFolder = ConfigurationManager.AppSettings["RootFolder"];
string folder= ConfigurationManager.AppSettings["Folder"];
// global param (actually accessed by ((MainFormName)mainParent)).g_fullOriginalRoot
string g_fullOriginalRoot = prePath + "\\" + rootFolder + "\\" + fodler;
I do this in the application MDI parent form (so it never die)
I did this because I found out that I call those keys many times and now I can get the data from the parent.
I wonder, if my solution is correct?
Are app.config parameters loaded as globals?