In property programming method, when we use Step Into (F11) key for debugging, execution bar is completing its task within Main() method without going to the class like traditional method. Please explain the reason for that.
using System;
public class CreateStudent
{
public static void Main()
{
Student oneSophomore = new Student();
oneSophomore.Id = 951;
oneSophomore.Name = "Ross";
oneSophomore.GPA = 3.5;
Console.WriteLine
("The student named {0} has ID # is {1} and a gpa of {2}",
oneSophomore.Name, oneSophomore.Id, oneSophomore.GPA);
Console.Read();
}
}
class Student
{
private int idNumber;
private string lastName;
private double gradePointAverage;
public int Id
{
get { return idNumber; }
set { idNumber = value; }
}
public string Name
{
get { return lastName; }
set { lastName = value; }
}
public double GPA
{
get { return gradePointAverage; }
set { gradePointAverage = value; }
}
}
//The student named Ross has ID # is 951 and a gpa of 3.5
Loading

VulpesPosted Oct 21, 2014, 7:22 AM
http://msdn.microsoft.com/en-us/library/vstudio/cc667388(v=vs.100).aspx
Some other 'stepping' options are listed in the side-bar on the left.
MahaPosted Oct 21, 2014, 7:35 AM
MahaPosted Oct 21, 2014, 4:21 AM
I unchecked it and program is working as usual.
I wish to know whether 'Step over properties and operators' feature only for the properties program.
VulpesPosted Oct 20, 2014, 3:38 PM
If there is and it's checked, then this would explain why the debugger is not going into the property setters but is staying in the Main() method.
MahaPosted Oct 20, 2014, 2:22 PM
This is the way F11 key works:
When I click it, it execute the code in Main() method one by one. Finally it ends up in Console.Read() method and black window pop-up and display the result.
VulpesPosted Oct 20, 2014, 9:13 AM
Are you sure that you're not using Debug->Step Over (F10) or that you have 'Step over properties and operators' ticked under debug Options and Settings?
MahaPosted Oct 20, 2014, 7:57 AM
VulpesPosted Oct 20, 2014, 7:48 AM
When I press F11, the debugger moves to this line:
oneSophomore.Id = 951;
and when I press it again, it moves to the setter of the Id property:
set { idNumber = value; }
So I don't really understand what you mean about the debugger not going into the Student class?
MahaPosted Oct 20, 2014, 5:08 AM
Riddhi ValechaPosted Oct 20, 2014, 4:59 AM
We can debug and find the reason.