Programming in C# — Question 69
You are creating an application that reads from a database.
You need to use different databases during the development phase and the testing phase by using conditional compilation techniques.
What should you do?
Answer options
- A. Configure the Define TRACE constant setting in Microsoft Visual Studio.
- B. Decorate the code by using the [DebuggerDisplay("Mydebug")] attribute.
- C. Configure the Define DEBUG constant setting in Microsoft Visual Studio.
- D. Disable the strong-name bypass feature of Microsoft .NET Framework in the registry.
Correct answer: C
Explanation
The correct answer is C, as configuring the Define DEBUG constant allows for conditional compilation that can help switch database connections in different environments. Option A is incorrect because TRACE is not specifically used for distinguishing between development and testing. Option B does not affect conditional compilation, and option D is unrelated to the compilation process.