■
Note
The
System.Diagnostics
namespace provides the
[Conditional]
attribute, which can be applied to a
class or method. Chapter 16 will explain the role of attributes in detail; however, for now, simply know that if you
use
[Conditional]
, you are not required to use the related preprocessor symbols.
By default, Visual Studio 2008 always defines a DEBUG symbol; however, this can be prevented by
deselecting the Define DEBUG constant check box option located under the Build tab of your pro-
ject’s Properties page. Assuming you did disable this autogenerated DEBUG symbol, you could now
define this symbol on a file-by-file basis using the #define preprocessor directive:
#define DEBUG
using System;
namespace PreprocessorDirectives
{
class Program
{
static void Main(string[] args)
{
Do'stlaringiz bilan baham: |