Example
The following code fragment shows an example of an App.config XML file for a C# messaging application. The code concerned with customizing the default property values is explained.
You can use the example to copy and paste the appropriate lines of code to the App.config file of your C# messaging application.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="webMethods.Msg"
type="System.Configuration.SingleTagSectionHandler" />
<section name="log4net"
type="System.Configuration.IgnoreSectionHandler" />
</configSections>
<webMethods.Msg Broker="Broker #1@localhost:6849" Timeout="30000"
...
/>
Inside the <ConfigSections> block, add a section element with the name attribute equal to webMethods.Msg and the type attribute equal to System.Configuration.SingleTagSectionHandler:
<section name="webMethods.Msg"
type="System.Configuration.SingleTagSectionHandler" />
Both of the above lines are required to reconfigure the default values.
After the <configSections> block, add an element with the section name that you identified previously. Then, add the properties whose defaults you want to reconfigure, and enclose their values in double quotes.
<webMethods.Msg Broker="Broker #1@localhost:6849" Timeout="30000".../>
Note that you can still override any of these reconfigured default values programmatically.
You can include additional <section> blocks for other applications in the application configuration file. For example, to include log4net, an open source utility designed for .NET logging services, you would use the following lines:
<section name="log4net"
type="System.Configuration.IgnoreSectionHandler" />