Is there a nice way to set a constant to be that of a classes namespace?
namespace ACMECompany.ACMEApp.Services
{
public class MyService
{
private const string WhatWeDo = "ACMECompany.ACMEApp.Services";
private const string WouldBeNice = typeof(MyService).Namespace;
...
}
}
So that if the class if moved to another namespace we don't need to worry about these constants.
More Info The constant is only really used for logging - where it is passed to some log method. This is all legacy code so wont be changing in the short term. I am aware of runtime ways to get this information such as This Question
We're using .NET 4 but will be upgrading soon to .NET 4.5.