Loading ...

How to put conditional breakpoints

Who is online?  0 guests and 1 members
home  »  articles  »  How to put conditional breakpoints

How to put conditional breakpoints

(2020)
0
/5
Avg: 0/5: (0 votes)
Published: 7/13/2009 by  Raghav Khunger

In this article I will explain how to put conditional breakpoints to avoid debugging continuously particularly in loops to find a particular value inside a loop.


I have used the below code to explain that.

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

 

public partial class _Default : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

int j = 0;

for (int i = 0; i <= 20; i++)

{

j = i;

}

}

}



Now put breakpoint on the line where j=i; is written

 


Now right click on that breakpoint. Click Condition

 





 

 

Enter i==6 in Condition textbox and click ok.

 

 

You will see a plus sign will appear in breakpoint.

 

 


Now run the code and you will see that breakpoint will hit when i is equals to 6

 


The above stuff is helpful when we found ourself  repeatedly stepping inside loop during debugging, and then we wait to get to a particular loop value .So with Conditional Breakpoints,we can avoid that tidy waiting.


Happy Reading.!


 

 

Comments (no comments yet)

Confirm

Product Spotlight

ASP.NET Hosting Spotlight

Most Recent Articles

 

Product Spotlight

ASP.NET Hosting Spotlight

Quick Vote

What kind of email newsletter would you prefer to receive from CodeAsp.Net?