Configuration Type is basically just the type of the custom class you define to represent the configuration values you want to store in the App.Config or Web.Config
Your custom config section needs to inherit from System.Configuration.ConfigurationSection
and when you use the GetSection
method, you need to cast the return value as the type of your Custom class that you inherited off of System.Configuration.ConfigurationSection
see more here
An example would be if I had a special class to represent a property I wanted to store in either the App.Config or Web.Config such as:
public class MyConfig : ConfigurationSection
{
[ConfigurationProperty("myConfigProp", DefaultValue = "false", IsRequired = false)]
public Boolean MyConfigProp
{
get
{
return (Boolean)this["myConfigProp"];
}
set
{
this["myConfigProp"] = value;
}
}
}
Any time I would want to access that property I would do the following in my code:
//create a MyConfig object from the XML in my App.Config file
MyConfig config = (MyConfig)System.Configuration.ConfigurationManager.GetSection("myConfig");
//access the MyConfigProp property
bool test = config.MyConfigProp;