Conditional Compilation

Conditional compilation is the process of writing code that might or might not be compiled into the application depending upon conditions set at compile time. Conditional compilation appeared in Visual Basic 4, and its original purpose was to allow for a single code base that could be compiled into either a 16-bit or 32-bit application. This was necessary because 16-bit and 32-bit API calls required different declaration statements and often returned values of different data types. Conditional compilation is no longer needed for this task, but it makes an excellent debugging aid.

Conditional compilation allows you to write lots and lots of debugging code that can easily be left out of a distribution build. Without conditional ...

Get Practical Standards for Microsoft® Visual Basic® .NET, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.