Debug and Trace Output : Debug : Development C# Examples


C# Examples » Development » Debug »

 

Debug and Trace Output









    
//  compile  with:  csc  /r:system.dll  file_1.cs
using  System;
using  System.Diagnostics;

class  MyClass
{
        [Conditional("DEBUG")]
        public  void  VerifyState()
        {
                Debug.Assert(2  ==  0,  "Bad  State");
        }
}

class  MainClass
{
        public  static  void  Main()
        {
                Debug.Listeners.Clear();
                Debug.Listeners.Add(new  TextWriterTraceListener(Console.Out));
                MyClass  c  =  new  MyClass();
                
                c.VerifyState();
                c.VerifyState();
        }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Development
» Debug