Click here to Skip to main content
16,005,169 members
Home / Discussions / C#
   

C#

 
GeneralRe: FileAttributes question Pin
Rickard Andersson202-Jun-02 7:59
Rickard Andersson202-Jun-02 7:59 
GeneralRe: FileAttributes question Pin
Mazdak2-Jun-02 8:04
Mazdak2-Jun-02 8:04 
GeneralRe: FileAttributes question Pin
Rickard Andersson202-Jun-02 8:10
Rickard Andersson202-Jun-02 8:10 
GeneralRe: FileAttributes question Pin
ygxdha2-Jun-02 16:15
ygxdha2-Jun-02 16:15 
GeneralRe: FileAttributes question Pin
Humpo3-Jun-02 23:26
Humpo3-Jun-02 23:26 
GeneralQuick Question Pin
Nick Parker2-Jun-02 6:17
protectorNick Parker2-Jun-02 6:17 
GeneralRe: Quick Question Pin
Rickard Andersson202-Jun-02 7:51
Rickard Andersson202-Jun-02 7:51 
GeneralRe: Quick Question Pin
Joshua Nussbaum2-Jun-02 21:41
Joshua Nussbaum2-Jun-02 21:41 
A good method is using a singleton class that is loaded on demand.

MyAppSettings - a class that is the equivalent of a global variable:

public class MyAppSettings {

// make private since class should not be intatiated directly
private MyAppSettings() {
// ...
}

// this one property
public string Setting1 {
get {
// read the data from a database or from a file
}
set {
// save the data to a database or file
}
}

private static MyAppSettings _settings = null;
public static MyAppSettings Instance {
get {
if (_settings == null)
_settings = new MyAppSettings();

return _settings;
}
}
}

Not only does this class define global variables, but it insures that only one instance of the data is floating around.
To access you global data:

MyAppSettings.Intance.Setting1 = "xyz";


hope this helps
GeneralObject unknown Pin
sharon2-Jun-02 1:43
sharon2-Jun-02 1:43 
GeneralRe: Object unknown Pin
James T. Johnson2-Jun-02 12:14
James T. Johnson2-Jun-02 12:14 
GeneralPlatform Invoke .... Qn Pin
Kannan Kalyanaraman2-Jun-02 0:10
Kannan Kalyanaraman2-Jun-02 0:10 
GeneralRe: Platform Invoke .... Qn Pin
Nish Nishant2-Jun-02 0:20
sitebuilderNish Nishant2-Jun-02 0:20 
GeneralFocus Pin
Mazdak1-Jun-02 23:00
Mazdak1-Jun-02 23:00 
GeneralRe: Focus Pin
Nish Nishant2-Jun-02 0:22
sitebuilderNish Nishant2-Jun-02 0:22 
GeneralRe: Focus Pin
Mazdak2-Jun-02 0:29
Mazdak2-Jun-02 0:29 
GeneralRe: Focus Pin
Nish Nishant2-Jun-02 0:37
sitebuilderNish Nishant2-Jun-02 0:37 
GeneralRe: Focus Pin
Mazdak2-Jun-02 0:39
Mazdak2-Jun-02 0:39 
GeneralRe: Focus Pin
Nish Nishant2-Jun-02 0:36
sitebuilderNish Nishant2-Jun-02 0:36 
GeneralRe: Focus Pin
James T. Johnson2-Jun-02 12:21
James T. Johnson2-Jun-02 12:21 
GeneralRe: Focus Pin
Rocky Moore2-Jun-02 10:03
Rocky Moore2-Jun-02 10:03 
GeneralRe: Focus Pin
Mazdak2-Jun-02 10:14
Mazdak2-Jun-02 10:14 
GeneralRe: Focus Pin
James T. Johnson2-Jun-02 12:23
James T. Johnson2-Jun-02 12:23 
GeneralRe: Focus Pin
Mazdak2-Jun-02 19:19
Mazdak2-Jun-02 19:19 
GeneralMultiple forms Pin
Paddy1-Jun-02 20:02
Paddy1-Jun-02 20:02 
GeneralRe: Multiple forms Pin
Mazdak1-Jun-02 22:57
Mazdak1-Jun-02 22:57 

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.