Programming in C# — Question 123
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. Specify the /define compiler option.
- C. Run the Assembly Linker tool from the Windows Software Development Kit (Windows SDK).
- D. Decorate the code by using the [assembly:AssemblyDelaySignAttribute(true)] attribute.
Correct answer: B
Explanation
The correct answer is B, as specifying the /define compiler option allows you to define conditional compilation symbols that can be used to switch between different database configurations. Option A is incorrect because configuring the TRACE constant does not address the need for different databases. Option C is not relevant since the Assembly Linker tool is used for different purposes. Option D is also unrelated to conditional compilation for databases.