Yeah, i was hoping i would be able to just open up 2 lots of
ConfigurationManager instances, 1 to retrieve from Application Data folder
and one to retrieve from the .exe folder.
How do you handle the first run? Do you have to attempt to read the values,
if they dont exist write them out, or is there a system for setting default
values? (ie similar to using the registry, when retrieving keys there is the
option to specify a default value if the key was empty).
Thanks,
Mark
> If the configuration data is per-user specific then saving it to the
> same directory as the .exe file (even if installed on a network) is a
[quoted text clipped - 19 lines]
>
> NuTcAsE
NuTcAsE - 17 Jan 2006 17:40 GMT
See inline...
>How do you handle the first run? Do you have to attempt to read the values,
>if they dont exist write them out, or is there a system for setting default
>values? (ie similar to using the registry, when retrieving keys there is the
>option to specify a default value if the key was empty).
If you are using custom configuration sections, then yes there is an
attribute you can apply to your properties / fields that contains the
default valules. So when you get the custom configuration section from
ConfigurationManager, it will contain its default values since the
section does not exist.
When applying a ConfigurationPropertyAttribute on a property of your
custom configuration you can supply a default value of that property.
Creating custom configurations :
http://msdn2.microsoft.com/library/ms228062.aspx