locked
C# properties.settings RRS feed

  • Question

  • In C# desktop 2008 and 2010 applications, I have seeb code where the properties.settings file was accessed alot.
     Thus can you tell me what the properties.settings file is setup for? Is is purpose the same or similar to an app.config file?
    Sunday, October 21, 2012 11:29 PM

Answers

  • Can you explain the following:"the values that you enter in Properties.Settings actually get saved into the app.config."

    Look at the following picture. I have added a Setting called Example with the value TEST.

    And now look at the effect that it had on the app.config:

    app.config

    As you can see, the values that were entered into Settings.settings get actually saved into app.config.

    • Proposed as answer by Norkk Monday, October 22, 2012 1:31 PM
    • Marked as answer by jazz_dog Thursday, October 25, 2012 3:52 AM
    Monday, October 22, 2012 5:58 AM
  • Hope this helps you

    http://msdn.microsoft.com/en-us/library/aa730869(v=vs.80).aspx


    Mark it as helpful if so! Thanks

    • Marked as answer by jazz_dog Thursday, October 25, 2012 3:52 AM
    Monday, October 22, 2012 1:25 PM

All replies

  • Is is purpose the same or similar to an app.config file?

    In fact, the values that you enter in Properties.Settings actually get saved into the app.config. The data in app.config represent the values for the Settings that you configured as "Application", and the default values for those that you configured as "User" (when the user changes those values from the default, the new values are saved to a new .config under the user's documents folder).

    Visual studio generates some code from the information that you entered in Properties.Settings, so that when this auto-generated code is compiled along with your application, you can access those Application and User values from their storage in .config in a type-safe way and with a code that is much simpler than using directly the AppSettings in the System.Configuration namespace. Basically, Visual Studio generates a wrapper around System.Configuration to facilitate reading the .config files.

    Sunday, October 21, 2012 11:41 PM
  • Can you explain the following:"the values that you enter in Properties.Settings actually get saved into the app.config."

    I do not understand exactly what you mean?

    Sunday, October 21, 2012 11:56 PM
  • Can you explain the following:"the values that you enter in Properties.Settings actually get saved into the app.config."

    Look at the following picture. I have added a Setting called Example with the value TEST.

    And now look at the effect that it had on the app.config:

    app.config

    As you can see, the values that were entered into Settings.settings get actually saved into app.config.

    • Proposed as answer by Norkk Monday, October 22, 2012 1:31 PM
    • Marked as answer by jazz_dog Thursday, October 25, 2012 3:52 AM
    Monday, October 22, 2012 5:58 AM
  • Hope this helps you

    http://msdn.microsoft.com/en-us/library/aa730869(v=vs.80).aspx


    Mark it as helpful if so! Thanks

    • Marked as answer by jazz_dog Thursday, October 25, 2012 3:52 AM
    Monday, October 22, 2012 1:25 PM