real time use of app.config

I am sorry, can anybody tell me why we are using app.config.

Could you please give me a real time excample of its usage

I heared if you want to set our code to run in a spcific version of CLR we can configure it in app.config. Can anybody explain these scenario

I would greatly appriciate anybody can provide separate answers for all my questions.




Answer this question

real time use of app.config

  • Grahame Edwards

    the configuration file is important in .net framewrok you can use it to control and store many things

    in your application like in previouse platform we stored this values in registry or in .ini file

    for example you can store your Connection string in it instead of hardecode it in your application so you can change it in the future iwhith out the need to recompile your application

    Configuration file has many categories and sections which control many things like startup settings runtime settings ,remoting etc

    about what you asked for (to bind to specific CLR version) you can set this information via <startup> elemnt which has to childs

    <requiredRuntime> Specifies that the application supports only version 2.0 for example

    <supportedRuntime> Specifies which versions of the common language runtime the application supports ie v1 and two

    For example

    <startup>
    <requiredRuntime version="v1.0.3705"/>
    <!-- order of these keys determines preference -->
    <supportedRuntime version="v1.1.4322"/>
    <supportedRuntime version="v1.0.3705"/>
    </startup>

    another thing you can store many option using setting dialog

    Write click on your project ->Properties->select Settings tab->write the keys and values

    you can access them later using Setting class



  • scribework

    Thanks a lot. Your reply is accurate enough to clear my doubts about config files. Thanks



  • real time use of app.config