GlobalMultiuse?

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

    GlobalMultiuse?

    How can I make an item accessible to all areas of my assembly? For instance
    say I have a string constant called sProgramName that I set to be "My
    Program" located in a class called CConstants. How can I make this string
    accessible to all classes within my assembly without 1) having to
    instantiate a class or 2) reference the class (eg I want to just reference
    sProgramName not CConstants.sPro gramName)?

    Thanks

    Alan


  • Mattias Sjögren

    #2
    RE: GlobalMultiuse?

    Alan,
    [color=blue]
    >How can I make this string
    > accessible to all classes within my assembly without 1) having to
    > instantiate a class[/color]

    Constants are implicitly static so you never need to instantiate the class
    to access it. Just make sure the constant is public or internal so other
    classes can reference it.

    [color=blue]
    >2) reference the class (eg I want to just reference sProgramName not CConstants.sPro gramName)?[/color]

    That you can't do.


    Mattias

    Comment

    Working...