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
  1. Home
  2. The Lounge
  3. Style question

Style question

Scheduled Pinned Locked Moved The Lounge
questioncsharp
22 Posts 16 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.
  • T Tim Carmichael

    Before you get your flamethrowers out... this is a question about coding style and preference, not asking a coding question per se... While I do code, it is not as often as it used to be, and I have to rethink how some things are/should be done. In a .NET application, what process should be used to obtain a series of Setting values? A procedure? A function? Local variables? Global variables? Pass a structure? Just looking for advice... Tim

    M Offline
    M Offline
    MartinSmith74
    wrote on last edited by
    #21

    Just do what a tool such as Resharper or CodeRush suggests Then you can spend your time thinking about more important things

    1 Reply Last reply
    0
    • T Tim Carmichael

      Before you get your flamethrowers out... this is a question about coding style and preference, not asking a coding question per se... While I do code, it is not as often as it used to be, and I have to rethink how some things are/should be done. In a .NET application, what process should be used to obtain a series of Setting values? A procedure? A function? Local variables? Global variables? Pass a structure? Just looking for advice... Tim

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

      I manage my own settings (i.e. "config file") using environment variables to determine where to store them (e.g. "Program Data"; "User Data"; "Documents and Settings"; whatever ... depends on the OS). You can use the .NET "built-in" functions for managing "user.config", but .NET tends to create multiple folders, and copies of your config.file, when you start "versioning" your program (can get really confusing / messy ... IMO). As for "consumers" of your settings ... use "dependency injection". (In some cases, settings could be stored on a web server and accessed via a web service by the clients when you're dealing with an app that is "distributed"; e.g. kiosks). Since we're talking .NET ... manage you settings with a class; serialize and deserialize them using XML; and retrieve them initially at app start-up. (A "procedure" is just a "function" that "returns" void ... IMO).

      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