Defensive Programming:Conditional Methods : Debug Trace « Development Class « C# / C Sharp

Defensive Programming:Conditional Methods


using System;
using System.Diagnostics;

class MyClass
    public MyClass(int i)
        this.i = i;
    public void VerifyState()
        if (i != 0)
        Console.WriteLine("Bad State");
    int i = 0;

public class DefensiveProgrammingConditionalMethods
    public static void Main()
        MyClass c = new MyClass(1);


Related examples in the same category

1.Using BooleanSwitchUsing BooleanSwitch
2.Debug class
3.Debug and ProfileDebug and Profile
4.Trace to event log
5.Trace to debuger: writeline and flush
6.Trace class: listener and writeline
7.Tracing To A File
8.Tracing Example
9.demonstrates debug outputdemonstrates debug output
10.illustrate the use of the debuggerillustrate the use of the debugger
11.A simple demonstration of the Debug class
12.Demonstrate indenting debug messages
13.Demonstrates routing debug messages to a fileDemonstrates routing debug messages to a file
14.Debug and Trace Output
15.Using Switches to Control Debug and Trace:BooleanSwitch
16.Using Switches to Control Debug and Trace:TraceSwitch
17.Using Switches to Control Debug and Trace:User-Defined Switch
18.Object Dumper