Tigroux32

Hello,

I want to create function use only if it's a not demo mode.

For this I would like to use [Conditional("DEMO")] and #define DEMO

But it's possible to define or undef DEMO during the execution

If not how can I define Demo fonction and not demo fonction, whitout testing this in all function.

Sorry for my English

Thanks for your help



Re: Visual C# General #define DEMO and [Conditional("DEMO")]

houtexwebdev

In your Project Properties, Build, Conditional Compilation Symbols





Re: Visual C# General #define DEMO and [Conditional("DEMO")]

Tigroux32

I would like to do this in execution not at the compilation



Re: Visual C# General #define DEMO and [Conditional("DEMO")]

Alan M.

why not just use a boolean variable then




Re: Visual C# General #define DEMO and [Conditional("DEMO")]

ThE_lOtUs

#define are process before the code is compile (this way to can have code specific for debug that you don't want to see in the release binary) and I think [Conditional("DEMO")] also.

If you want to make the changes at runtime, you have no choice but to use a boolean.






Re: Visual C# General #define DEMO and [Conditional("DEMO")]

Tigroux32

Ok thank you I hope to can do this without boolean



Re: Visual C# General #define DEMO and [Conditional("DEMO")]

Matthew Watson

Your requirement effectively stipulates the use of a boolean at runtime.

There is no other way to do it.