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. General Programming
  3. C#
  4. Global Variables

Global Variables

Scheduled Pinned Locked Moved C#
question
3 Posts 3 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.
  • S Offline
    S Offline
    STW
    wrote on last edited by
    #1

    Is there a way to make Global Vaiables? Can I add them to the Application or ApplicationContext? Stefan

    K C 2 Replies Last reply
    0
    • S STW

      Is there a way to make Global Vaiables? Can I add them to the Application or ApplicationContext? Stefan

      K Offline
      K Offline
      kobyb
      wrote on last edited by
      #2

      U can use singleton class with public properties Koby

      1 Reply Last reply
      0
      • S STW

        Is there a way to make Global Vaiables? Can I add them to the Application or ApplicationContext? Stefan

        C Offline
        C Offline
        Colin Angus Mackay
        wrote on last edited by
        #3

        Global variables are generally a sign of poorly thought out design. However there are cases when you want to make something available to classes across your application (like values from the application's config class). I would suggest a couple of approaches: 1. Is to make the variable available through a static property of an appropriate class. 2. Is to make a class (a singleton) that exposes these values through static properties. For instance a Config class that retrieves the information from a config file and exposes them to the rest of the application.


        "You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar Coming soon: The Second EuroCPian Event

        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