How to do it...

  1. Add the following code to your Program.cs file. We are simply creating a list of integers and looping through that list:
        List<int> myList = new List<int>() { 1, 4, 6, 9, 11 }; 
foreach(int num in myList)
{
Console.WriteLine(num);
}
Console.ReadLine();
  1. Next, place a breakpoint on the Console.WriteLine(num) line of code inside the loop:
  1. Right-click on the breakpoint and select Conditions... from the context menu:
  1. You will now see that Visual Studio opens a Breakpoint Settings window. Here we specify that the breakpoint needs to be hit only when the value of num is 9. You can add several conditions and specify different conditions. The condition logic is really flexible:
  1. Debug your console application. You will see that when the breakpoint is hit, the value of num is 9:
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.186.219