Namespace constant in C#
        Posted  
        
            by pm_2
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by pm_2
        
        
        
        Published on 2010-05-12T11:30:51Z
        Indexed on 
            2010/05/12
            11:34 UTC
        
        
        Read the original article
        Hit count: 315
        
Is there any way to define a contsant variable for an entire namespace, rather than just within a class? For example:
namespace MyNamespace
{    
    public const string MY_CONST = "Test";
    static class Program
    {
    }
}
Gives a compile error as follows:
Expected class, delegate, enum, interface, or struct
© Stack Overflow or respective owner