I'm trying to port some code into .net which has a load of #define'd values e.g.
#define MY_CONSTANT (512)
#define MY_VERSION_STRING "v42.2"
When I import a cli library the #define's are lost. Is there a way of defining constants in the scope of a namespace. I was thinking something like this:
namespace MyNamespace
{
const int MY_CONSTANT = 512;
const String^ MY_VERSION_STRING = "v42.2";
}
So in future I could refer to that as:
int myVar = MyNamespace::MY_CONSTANT;
String^ myVar = MyNamespace::MY_VERSION_STRING;
[Edit] Some of the constants are strings so an enum won't solve the general case.
[Edit2] I'm using C++/CLI here and right now interoperability with other .net languages is not a priority. That said, if there's a more .net-like way of solving this (i.e. standard practice) I'd rather go with that.