Scope problem

  • Thread starter Thread starter Gudni G. Sigurdsson
  • Start date Start date
G

Gudni G. Sigurdsson

I am new to C# and use MS Visual C# .NET.
I have defined a class, Config. I create one instance of this class at
the begin of my program and would like this instance to have a global
scope within my program (it contains configuration data to be used in
various other classes). Where should I put the following lines or, what
should I do to make the instance cf of Config globally visible:

Config cf;
cf = new Config();

Sincerely,
Gudni G. Sigurdsson
 
Gudni G. Sigurdsson said:
I am new to C# and use MS Visual C# .NET.
I have defined a class, Config. I create one instance of this class at
the begin of my program and would like this instance to have a global
scope within my program (it contains configuration data to be used in
various other classes). Where should I put the following lines or, what
should I do to make the instance cf of Config globally visible:

Config cf;
cf = new Config();

See http://www.pobox.com/~skeet/csharp/singleton.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top