from
http://www.csharpfriends.com/Members/Main/Tutorials/get_tutorial.aspx?tutID=45
NET follows the convention of automatically loading configuration settings from a file from the same directory as the executable, where the filename is the executable's name with '.config' appended (e.g. for myapp.exe, the config file is myapp.exe.config). WorldConsole.exe.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="Message" value="Hello, World!" />
</appSettings>
</configuration>
WorldConsole.cs:
using System;
using System.Configuration;namespace World
{
class WorldConsole
{
static void Main(string[] args)
{
Console.WriteLine(ConfigurationSettings.AppSettings["Message"]);
}
}
}
http://www.csharpfriends.com/Members/Main/Tutorials/get_tutorial.aspx?tutID=45
NET follows the convention of automatically loading configuration settings from a file from the same directory as the executable, where the filename is the executable's name with '.config' appended (e.g. for myapp.exe, the config file is myapp.exe.config). WorldConsole.exe.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="Message" value="Hello, World!" />
</appSettings>
</configuration>
WorldConsole.cs:
using System;
using System.Configuration;namespace World
{
class WorldConsole
{
static void Main(string[] args)
{
Console.WriteLine(ConfigurationSettings.AppSettings["Message"]);
}
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货