Demonstrate the Conditional attribute

// Demonstrate the Conditional attribute.
#define TRIAL
using System;
using System.Diagnostics;
public class TestAno {
[Conditional("TRIAL")]
void trial() {
Console.WriteLine("Trial version, not for distribution.");
}
[Conditional("RELEASE")]
void release() {
Console.WriteLine("Final release version.");
}
public static void Main() {
TestAno t = new TestAno();
t.trial(); // call only if TRIAL is defined
t.release(); // called only if RELEASE is defined
}
}
Related examples in the same category