Global properties

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Art

    #1

    Global properties

    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
  • Dennis

    #2
    RE: Global properties

    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.
    --
    Dennis in Houston


    "Art" wrote:
    [color=blue]
    > 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[/color]

    Comment

    • Cor Ligthert [MVP]

      #3
      Re: Global properties

      Art,

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

      Cor


      Comment

      Working...