I'd like to use some of the techniques discussed here for reading a
config file in .NET 2.0:
http://msdn.microsoft.com/msdnmag/is...s/default.aspx
Here's my app.config content:
<?xml version="1.0" encoding="utf-8" ?>
<configuratio n>
<configSections >
<section name="DebugClea nFile" type="System.Bo olean,
ConfigurationPr operty, Version=1.0.0.0 , Culture=neutral ,
PublicKeyToken= null" allowDefinition ="Everywhere "
allowExeDefinit ion="MachineToA pplication"
restartOnExtern alChanges="true " value="true"/>
</configSections>
<system.diagnos tics>
</system.diagnost ics>
</configuration>
Here's the code snippet:
using System;
using System.Collecti ons.Generic;
using System.Text;
namespace TestConsole
{
class RunProg
{
public static void Main( string[ ] args )
{
AppConfigFileEn gine appconfig = new AppConfigFileEn gine();
object debugClean = appconfig.Debug CleanFile.Defau ltValue;
}
}
class AppConfigFileEn gine :
System.Configur ation.Configura tionSection
{
public System.Configur ation.Configura tionProperty
DebugCleanFile = new
System.Configur ation.Configura tionProperty("D ebugCleanFile",
typeof(bool));
}
}
The default value on debugClean is always false. I also get this
warning from the app.config file:
The 'value' attribute is not declared.
I simply want to read a different properties, along with their set
value, out of the config file using something similar to the above
structure. What am I doing wrong?
I'd also like to declare debugClean as a bool instead of object. How
can that be done?
Thanks,
Brett