Exam4Training

How should you complete the relevant code?

DRAG DROP

You are testing an application. The application includes methods named CalculateInterest and LogLine. The CalculateInterest() method calculates loan interest. The LogLine() method sends diagnostic messages to a console window.

You have the following requirements:

• The CalculateInterest() method must run for all build configurations.

• The LogLine() method must be called only for debug builds.

You need to ensure that the methods run correctly.

How should you complete the relevant code? (To answer, drag the appropriate code segments to the correct locations in the answer area. Each code segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)

Answer:

Explanation:

When the C# compiler encounters an #if directive, followed eventually by an #endif directive, it will compile the code between the directives only if the specified symbol is defined. Unlike C and C++, you cannot assign a numeric value to a symbol; the #if statement in C# is Boolean and only tests whether the symbol has been defined or not. For example,

#define DEBUG

#if DEBUG

Console.WriteLine("Debug version");

#endif

Reference: http://stackoverflow.com/questions/2104099/c-sharp-if-then-directives-for-debug-vs-release

Latest 70-483 Dumps Valid Version with 288 Q&As

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund

Exit mobile version