Global properties

G

Guest

Hi,

I could really use some suggestions. I've got a project that has a few
global variables -- such as default paths. I'd like to save and recall them.
It seemed to me that the best way is to serialize them to an XML file.

Normally, if I have a few global variables I put them in a module. I don't
know if I can serialize a module -- it seems fairly easy to serialize a class.

I assume everyone has to do something like this, and that there must be a
fairly standard way of handling these variables. Can anyone offer me any
suggestions?

Thanks very much

Art
 
G

Guest

I don't believe you can serialize a module but you can create a serializable
class that has all your variables as properties then serialize it to a file
when you exit your application and deserialize it when your application
starts. You can the access the properties of the class.
 
C

Cor Ligthert [MVP]

Art,

The answer is simple. Try to avoid modules (you don't really need them,
although a shared class is almost the same)..

Cor
 

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

Top