无法从APP.config读取密钥

时间:2017-06-06 09:55:42

标签: c# raspberry-pi

我有2个文件:

Program.cs和App.config

我试图用ConfigurationManager类读取App.config但我没有得到任何回报。

的Program.cs:

using System.Configuration;

String value = ConfigurationManager.AppSettings["mode"];
Console.WriteLine("APP_CONFIG: " + value);

我的App.Config:

<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="mode" value="0"/>
  </appSettings>
</configuration>

我在我的Pi上用mcs编译:

mcs /reference:"/usr/lib/mono/4.5-api/System.Configuration.dll" Program.cs

0 个答案:

没有答案