I'm a long time C programmer, but I'm only starting to learn C#, so forgive me if this is question that should be intuitively obvious.
In C, I dislike 'magic numbers' in code, such as this:
var_name = 1234; /* what is the significance of this value??? */
So instead, in C, I write something like this:
#define meaningFullName 1234 var_name = meaningFullName; /* this should be more readable*/
If that symbol is useful across other files in my C project, I stick it in a header file, so I can use it where ever I need it.
#include constants.h var_name = meaningFullName ; /* defined in constants.h */
As I understand it, I can't do that in c#, since #define is used for conditional compilation, and c# doesn't have #include, so I can't use a header file.
#define DEBUG /* DEBUG = true */ #if DEBUG do_something(); /* this will be executed */ #undef DEBUG /* DEBUG = false */ do_this(); /* this won't be executed */
So, how do I define symbolic constants in c# as I am used to doing in c, since #define has an entirely different meaning, and I can't #include a header file?