Replace #ifdefs in C# DLL

I have a C++ DLL which has #defines used like (these defines are automatically defined based on the build configuration, e.g. Debug, Release, etc)

#if defined(CONSTANT)
// Some code
// Some other code

I need same functionality in C# dll.
Is it ok if I define some global constants in C# dll and use them
instead of defines?

if(Globals.SomeConstant == SOMEVALUE)
// Do this
// Do smth else

Then when I want to ship the DLL I will in advance (probably as a default value during declaration) assign SOMEVALUE to Globals.SomeConstant – will this work this way? (Depending on which configuration I need).

I saw some similar questions but they weren’t about DLLs.

Source: dll

Leave a Reply