Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Best way to store user pref's

Best way to store user pref's

Scheduled Pinned Locked Moved C#
windows-adminquestion
6 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JDUK
    wrote on last edited by
    #1

    Whats the "best" (most widley accepted) way to store user preferences in a way they can be read and written to? I though of using .config and coding a way to write back to it .... but have since been told its bad programming practice to write to a .config. May be the registry? but im using this program as a peice of portfolio work to show potential employers and im not sure they would want a slew of candidates code writing to somthing as volotile and not-so easily cleaned as the reg' .... or is this somthing they will expect?

    M I L 3 Replies Last reply
    0
    • J JDUK

      Whats the "best" (most widley accepted) way to store user preferences in a way they can be read and written to? I though of using .config and coding a way to write back to it .... but have since been told its bad programming practice to write to a .config. May be the registry? but im using this program as a peice of portfolio work to show potential employers and im not sure they would want a slew of candidates code writing to somthing as volotile and not-so easily cleaned as the reg' .... or is this somthing they will expect?

      M Offline
      M Offline
      Marc Clifton
      wrote on last edited by
      #2

      IMO, the best way is whatever suits the requirements of the application. Do you want your users editing the config file themselves? Do you want the config information human-readable? Does your install program handle creating a registry entries? Are you installing your app as an "all-users" app and relying on Windows login to differentiate users, or does your app have a separate login? Is it a client-server app, where the user config might be on the server so the user gets his/her setting regardless of what client tmachine they are using? It's more a question of requirements than the current fad. Hope that helps. Marc My website
      Latest Articles: Object Comparer String Helpers

      M 1 Reply Last reply
      0
      • J JDUK

        Whats the "best" (most widley accepted) way to store user preferences in a way they can be read and written to? I though of using .config and coding a way to write back to it .... but have since been told its bad programming practice to write to a .config. May be the registry? but im using this program as a peice of portfolio work to show potential employers and im not sure they would want a slew of candidates code writing to somthing as volotile and not-so easily cleaned as the reg' .... or is this somthing they will expect?

        I Offline
        I Offline
        IamJunk
        wrote on last edited by
        #3

        try using a Database. Hopefully thats the widely used approach (if not file IO) Hope this helps!!!


        Regards, Sidhu IF YOU DON'T HAVE ANYTHING TO SAY, WELCOME TO THE CLUB Dotnet @ Work Where Dotnet works... My Blog

        K 1 Reply Last reply
        0
        • I IamJunk

          try using a Database. Hopefully thats the widely used approach (if not file IO) Hope this helps!!!


          Regards, Sidhu IF YOU DON'T HAVE ANYTHING TO SAY, WELCOME TO THE CLUB Dotnet @ Work Where Dotnet works... My Blog

          K Offline
          K Offline
          Khanh Duy
          wrote on last edited by
          #4

          I think you can use XML to store user's pref... The man with nothing to lose

          1 Reply Last reply
          0
          • J JDUK

            Whats the "best" (most widley accepted) way to store user preferences in a way they can be read and written to? I though of using .config and coding a way to write back to it .... but have since been told its bad programming practice to write to a .config. May be the registry? but im using this program as a peice of portfolio work to show potential employers and im not sure they would want a slew of candidates code writing to somthing as volotile and not-so easily cleaned as the reg' .... or is this somthing they will expect?

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            Take a look at the Configuration Application Block[^]. It's part of Microsoft's Enterprise Library. I used the Configuration Application Block in my last app. and it worked very well. Easy to implement, very flexible and a snap to set up and configure. Cheers, Drew.

            1 Reply Last reply
            0
            • M Marc Clifton

              IMO, the best way is whatever suits the requirements of the application. Do you want your users editing the config file themselves? Do you want the config information human-readable? Does your install program handle creating a registry entries? Are you installing your app as an "all-users" app and relying on Windows login to differentiate users, or does your app have a separate login? Is it a client-server app, where the user config might be on the server so the user gets his/her setting regardless of what client tmachine they are using? It's more a question of requirements than the current fad. Hope that helps. Marc My website
              Latest Articles: Object Comparer String Helpers

              M Offline
              M Offline
              Matt Gerrans
              wrote on last edited by
              #6

              On the other hand, you don't want to analyse the problem to death and paralyze the whole project, so just use an ini file. The important thing is to abstract your option loading and saving, so that you can plug in the popular method of the day. Then, of course, you'll discover that the ini file format is just fine 99.9% of the time and there's no need for the overkill of registry, SQL, XML, etc. Matt Gerrans

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups