c#中System.Configuration.ConfigurationManager.AppSettings的作用,使用时如何配置?
2个回答
展开全部
<AppSettings>
<add key="config1" value="aaa" />
<add key="config2" value="bbb" />
</AppSettings>
string str = System.Configuration.ConfigurationManager.AppSettings["config1"].ToString();//str等于aaa
string str1 = System.Configuration.ConfigurationManager.AppSettings["config2"].ToString();//str1等于bbb
<add key="config1" value="aaa" />
<add key="config2" value="bbb" />
</AppSettings>
string str = System.Configuration.ConfigurationManager.AppSettings["config1"].ToString();//str等于aaa
string str1 = System.Configuration.ConfigurationManager.AppSettings["config2"].ToString();//str1等于bbb
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询