Click here to Skip to main content
16,016,087 members
Home / Discussions / C#
   

C#

 
QuestionIE automation , image save Pin
yogesh_softworld12318-Sep-09 9:01
yogesh_softworld12318-Sep-09 9:01 
QuestionMissed events when using vb6 Activex in C# Pin
Member 533181818-Sep-09 8:07
Member 533181818-Sep-09 8:07 
QuestionHow to change 'this' Pin
RichardM118-Sep-09 7:45
RichardM118-Sep-09 7:45 
AnswerRe: How to change 'this' Pin
Ian Shlasko18-Sep-09 8:00
Ian Shlasko18-Sep-09 8:00 
QuestionGlobal Variables... Pin
JollyMansArt18-Sep-09 7:09
JollyMansArt18-Sep-09 7:09 
AnswerRe: Global Variables... Pin
Vikram A Punathambekar18-Sep-09 7:16
Vikram A Punathambekar18-Sep-09 7:16 
AnswerRe: Global Variables... Pin
PIEBALDconsult18-Sep-09 7:51
mvePIEBALDconsult18-Sep-09 7:51 
AnswerRe: Global Variables... Pin
Ian Shlasko18-Sep-09 8:14
Ian Shlasko18-Sep-09 8:14 
As Vikram and Piebald suggested, what you're looking for is a static class, which would contain static properties or fields.

If these are program-wide settings, as your post seems to suggest, you can simplify things further (And for that matter, keep it cleaner), by setting up static properties INSIDE the Program class.
public static string SystemSettingThingy { get; private set; }

public static void Main(string[] args)
{
   // Do startup things
   // Run initialization
   SystemSettingThingy = "MySetting";
}

// Elsewhere in the program:
if (Program.SystemSettingThingy == ...)


One of the main points here is that if it's inside the Program class, you can keep the setter private, so you can ensure that they are never modified. One of the reasons many developers consider globals to be a "bad idea," is that in complex programs, particularly multi-threaded ones, you can have different parts of the app writing to them at different times, and can never really rely on their accuracy.

Proud to have finally moved to the A-Ark. Which one are you in?
Developer, Author (Guardians of Xen)

QuestionBackgroundworker Pin
arkiboys18-Sep-09 7:05
arkiboys18-Sep-09 7:05 
AnswerRe: Backgroundworker Pin
Luc Pattyn18-Sep-09 7:11
sitebuilderLuc Pattyn18-Sep-09 7:11 
AnswerRe: Backgroundworker Pin
Luc Pattyn18-Sep-09 7:39
sitebuilderLuc Pattyn18-Sep-09 7:39 
AnswerRe: Backgroundworker Pin
Ian Shlasko18-Sep-09 8:19
Ian Shlasko18-Sep-09 8:19 
QuestionEnumerate a Listbox Pin
bxlorenz18-Sep-09 7:04
bxlorenz18-Sep-09 7:04 
AnswerRe: Enumerate a Listbox Pin
Luc Pattyn18-Sep-09 7:09
sitebuilderLuc Pattyn18-Sep-09 7:09 
QuestionCopy Files in C# with Duplicate Files (Corrupt ISO) Pin
Xtrodinary18-Sep-09 6:30
Xtrodinary18-Sep-09 6:30 
AnswerRe: Copy Files in C# with Duplicate Files (Corrupt ISO) Pin
jared.hildebrandt21-Oct-09 5:16
jared.hildebrandt21-Oct-09 5:16 
QuestionNo connection could be made because the target machine actively refused it Pin
Amritarth18-Sep-09 6:06
Amritarth18-Sep-09 6:06 
AnswerRe: No connection could be made because the target machine actively refused it Pin
EliottA18-Sep-09 6:31
EliottA18-Sep-09 6:31 
AnswerRe: No connection could be made because the target machine actively refused it Pin
Luc Pattyn18-Sep-09 6:31
sitebuilderLuc Pattyn18-Sep-09 6:31 
AnswerRe: No connection could be made because the target machine actively refused it Pin
Dave Kreskowiak18-Sep-09 7:27
mveDave Kreskowiak18-Sep-09 7:27 
AnswerRe: No connection could be made because the target machine actively refused it Pin
0x3c018-Sep-09 7:40
0x3c018-Sep-09 7:40 
AnswerRe: No connection could be made because the target machine actively refused it Pin
Arun Jacob18-Sep-09 19:00
Arun Jacob18-Sep-09 19:00 
QuestionHow to find total data downloaded and uploaded by user (using c# code) Pin
Ajay Kewale18-Sep-09 5:27
Ajay Kewale18-Sep-09 5:27 
AnswerRe: How to find total data downloaded and uploaded by user (using c# code) Pin
Eddy Vluggen18-Sep-09 9:53
professionalEddy Vluggen18-Sep-09 9:53 
QuestionHow to get upload status in steps Pin
vsaratkar18-Sep-09 5:12
vsaratkar18-Sep-09 5:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.