Use AppSettingsReader to load settings from app.config : AppSettingsReader : Development C# Examples


C# Examples » Development » AppSettingsReader »

 

Use AppSettingsReader to load settings from app.config









    
using  System;
using  System.Drawing;
using  System.Collections;
using  System.ComponentModel;
using  System.Windows.Forms;
using  System.Data;

public  class  MainClass  {

    [STAThread]
    static  void  Main()  
    {
        System.Configuration.AppSettingsReader  configurationAppSettings  =  new  System.Configuration.AppSettingsReader();
        Console.WriteLine((string)(configurationAppSettings.GetValue("label1.Text",  typeof(string))));

    }

}
/*  app.config
<?xml  version="1.0"  encoding="Windows-1252"?>
<configuration>
    <appSettings>
        <!--      User  application  and  configured  property  settings  go  here.-->
        <!--      Example:  <add  key="settingName"  value="settingValue"/>  -->
        <add  key="label1.Text"  value="label1"  />
    </appSettings>
</configuration>

*/
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Development
» AppSettingsReader