#define ?

  • Thread starter Thread starter Steven Blair
  • Start date Start date
Steven Blair said:
Does C# have something similar to #define (C/C++)

Well, that depends entirely on what you want it to do. You can use it
for conditional compilation, but you can't use it for macros, constants
etc.

For constants, you should use const variables, and for macros you
should just use methods.
 
Note the slight syntax differences from C++ too:

The #define statements have to be the first thing in the file and the
conditional is simply #if, not #ifdef or #if defined.

Jasper Kent
 
Back
Top