The following is the definition of or, which defines a parameter, the key is Isinit, and the value is false
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key ="IsInit" value="false"/>
</appSettings>
</configuration>
The following is the definition of the method for reading and writing config files:
Write:
Copy the codeThe code is as follows:
internal void settingApp_write(string key, string val)
{
config = ();
["IsInit"].Value = val;
();
("appSettings");
}
Read:
Copy the codeThe code is as follows:
internal string settingApp_read(string key)
{
var val = [key];
return val;
}
How to use:
Write test:
settingApp_write("IsInit","true");
Remove the test:
var setting = settingApp_read("Isinit");
This level of modification is the project-level config file modification, which is the operation of the config file in the Bin directory of your final program.