Illustrates use of the Conditional attribute

image_pdfimage_print

   

/*
illustrates use of the Conditional attribute
*/

#define USE_METHOD_1

using System;
using System.Diagnostics;

public class Example17_2 
{
    [Conditional("USE_METHOD_1")]
    public static void Method1()
    {
        Console.WriteLine("In Method 1");
    }

    public static void Main() 
    {

        Console.WriteLine("In Main");
        Method1();
    }
}