imagine the following code in VB.NET:
#Const TestCode = True
#If TestCode Then
Console.WriteLine("Test code enabled.")
#Else
Console.WriteLine("No test code.")
#End If
These conditions are executed in compilation time, but now I'm trying to give to the constant TestCode a value from a file or a database. The idea is to be able to change that constant value in run-time without the need of updating the software in production.
Anyone knows how to do that?
Thanks
#ifconditionally compiles the contained block of code, so ifTestCode = True, thenConsole.WriteLine("No test code.")is not even compiled. There would be no way to "switch over to it" at runtime because that line of code would not exist in the application binary. Why not just use a regularifinstead of compiler directives?