For example:
define.cs
#define FOO
form1.cs
#if FOO
MessageBox.Show("foo is set!");
#else
MessageBox.Show("foo is not set!");
#endif
the define.cs are included on same projet that form1.cs but the above condition give: foo is not!
In C#, scope of #define is only limited to file in which it is declared.
To define a symbol visible in all files, one way is to Project->Properties->Build->Conditional Compilation Symbols and specify the symbol "FOO" there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With