C#.net object persistence

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wademi
    New Member
    • Jan 2008
    • 3

    #1

    C#.net object persistence

    I am trying to create a simple application.
    I would like the users of this application to be able to set there user preferences and these settings to be permanently stored.
    For example the location of various folders (C:\test1

    I was thinking of creating an object/class which stores settings/path etc.

    How do I achieve this permanent storage of the settings?
    If a user shutdown there computer will the information be lost that is stored in an object?
    Do you have any examples of what I could do?
  • nateraaaa
    Recognized Expert Contributor
    • May 2007
    • 664

    #2
    You could store these settings in an xml file within your project. Another alternative would be to store these settings in a database table.

    Nathan

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #3
      .NET applications (at least 2.0+ does) have a built-in feature for this.
      If you go to your solution explorer, there is a section called "Properties ". Contained underneath it is the "Settings" (settings.setti ngs) section. Double click that will give you a nice place to enter in some objects and their default values. If you set the scope to user (and not application), each user will be able to have different values for the objects.
      You will have to add some code to your project to allow them to change/save their own values, but that is trivial.

      Comment

      Working...