C# Optional fields in application settings

Viewed 3624

Is there a way to create some optional fields in application settings. For example for one client we need some client based settings in the settings file, something like this:

<?xml version="1.0"?>
<configuration>
  <configSections>
    <userSettings>
      <setting name="Client_1_out_folder" serializeAs="String">
        <value>c:\</value>
      </setting>
      <setting name="Some_other_setting" serializeAs="String">
        <value>True</value>
      </setting>
      ...

And for the other client we dont need the Client_1_out_folder at all so to keep the config file clean would be nice to remove it from the config file all together. So for client 2 that part of config file would look like:

<?xml version="1.0"?>
<configuration>
  <configSections>
    <userSettings>
      <setting name="Some_other_setting" serializeAs="String">
        <value>True</value>
      </setting>
      ...
7 Answers
Related