Use Debug fail method : Assert Debug « Development Class « C# / C Sharp






Use Debug fail method

using System;
using System.Collections;
using System.Diagnostics;

class Class1 {
   static void Main(string[] args) {
     Debug.Fail("Fail Message", "An unexpected exception has been thrown.\n\n");
   }
}


           
       








Related examples in the same category

1.Defensive Programming:Asserts