I need to contain a set of static string properties under a namespace such as:
namespace1 N1 {
namespace N2 {
public const string A = "a";
}
public const string B = "c";
namespace N3 {
public const string A = "a";
}
}
Is it possible to have nested namespaces in C#? What is the better design approach? Using static classes or using namespaces in this case?
thanks
Yes, it is possible to have nested namespaces in C#.
However, it is impossible to have a constant directly inside a namespace. You have to put it into a class.