Overview of system. Monitoring aion:
The system. Configuration namespace includes the classes used to process configuration files, such as the classes in the operation configuration section, the classes used to obtain database connection strings, and the classes used to provide data verification.
Using the system. Configuration namespace, developers can obtain the configuration file management class "configurationmanager" and use it to dynamically Process configuration files. In the website, the default configuration file name is "Web. config ". In the project, the default configuration file name is "app. config ".
System. Configuration namespace class composition
The Configuration File Stores some basic configurations for running the PlayStation and program. classes in the system. Configuration namespace are responsible for dynamically managing these configurations. The following describes common classes for managing configurations and their descriptions.
Configuration File Information: configuration class
The configuration class is the main operation class for reading configuration files. It is the class associated with the Web. confing and App. config configuration files. These configuration files can be dynamically modified through the next class. To use the configuration class, you must first understand the terms of Several configuration files: configuration elements, configuration attributes, and configuration sections. The following code has this member.
<Configsections>
<Section name = "bookversion"> </sectioin>
</Configsections>
"Configsections" is the configuration section, "section" is the configuration element, and "name" is the configuration attribute.
<? XML version = "1.0" encoding = "UTF-8"?>
<Configuration>
<Configsections>
<Section name = "student" type = "system. configuration. dictionarysectionhandler"/>
</Configsections>
<Student>
<Add key = "name" value = "http://www.cnblogs.com/i80386/archive/2011/10/27/amily"/>
<Add key = "Age" value = "http://www.cnblogs.com/i80386/archive/2011/10/27/15"/>
<Add key = "sex" value = "http://www.cnblogs.com/i80386/archive/2011/10/27/female"/>
</Student>
</Configuration>
Note: configsections is equivalent to defining variables and must be placed in configuration
Idictionary istudent = (idictionary) configurationmanager. getsection ("student ");
String [] keys = new string [istudent. Keys. Count];
String [] values = new string [istudent. Keys. Count];
Istudent. Keys. copyto (keys, 0 );
Istudent. Values. copyto (values, 0 );
Foreach (var key in keys)
{
Console. writeline (key );
}
Foreach (VaR value in values)
{
Console. writeline (value );
}
Foreach (var key in istudent. Keys)
{
Console. writeline ("{0 }:{ 1}", key, istudent [Key]);
}