app.config常用总结

 App.config是系统配置文件,生成为xml,可以在程序生成后,方便修改一些常用字节

  <!-- 数据库连接串 -->

  <connectionStrings>

    <add name="Conn" connectionString="Data Source=.;User ID=******;Password=******;Initial Catalog=testDB;Integrated Security=False"/>

  </connectionStrings>

  <!-- 字符串 -->

  <appSettings>

    <add key="密码" value="password"/>

  </appSettings>

调用:

string conn = ConfigurationManager.ConnectionStrings["Conn"].ToString();

string password = ConfigurationManager.AppSettings["密码"];

你可能感兴趣的:(app.config常用总结)