4 Replies - 916 Views - Last Post: 10 August 2010 - 07:18 AM Rate Topic: -----

#1 Guest_Guest*


Reputation:

what is the best way to handle settings

Posted 08 August 2010 - 09:15 AM

i am going to use either a text file or xml for a simple (i mean very simple) game i wrote but i am wondering what would be the best way to have an options form. i am NOT asking for code just pointers. i want to have an options menu that gets the settings from the file, however they need to load if the file exists when the program starts since the program will read them. would just using a static class that i assign values to be best and have it pullt he values since then the whole program can be on the same page?

Is This A Good Question/Topic? 0

Replies To: what is the best way to handle settings

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4333
  • View blog
  • Posts: 12,128
  • Joined: 18-April 07

Re: what is the best way to handle settings

Posted 08 August 2010 - 11:07 AM

You could certainly have a static class pull in and store the settings. This was a popular use of structures back in the early programs. You could also decide to just have a series of functions which fetch settings from the file as needed. It is a bit more work and a little bit more clumsy, but still an option. You can also store settings internally to the program using the Application settings (ConfigurationSettings class).

Which way you choose depends on the comfort level, ability to access the settings, and the number of settings you want or plan to have. :)
Was This Post Helpful? 1
  • +
  • -

#3 Curtis Rutland  Icon User is online

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 4485
  • View blog
  • Posts: 7,813
  • Joined: 08-June 10

Re: what is the best way to handle settings

Posted 08 August 2010 - 02:02 PM

I'll throw my vote in for the app.config or settings.settings file. Both are quite easy to get to from code that's already built in.
Was This Post Helpful? 1
  • +
  • -

#4 FlashM  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 382
  • View blog
  • Posts: 1,195
  • Joined: 03-December 09

Re: what is the best way to handle settings

Posted 10 August 2010 - 07:07 AM

I would load setting in memory in some static class and then retrieve them as needed... That way you don't have to access your settings file every time you need some setting.
Was This Post Helpful? 0
  • +
  • -

#5 Sergio Tapia  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1253
  • View blog
  • Posts: 4,168
  • Joined: 27-January 10

Re: what is the best way to handle settings

Posted 10 August 2010 - 07:18 AM

The app.config or settings.settings file is the best way to use settings for your .NET application. There are built in functions that will simplify your code greatly.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1