I'm debugging a program I'm not at all familiar with in Visual Studio 2022.
I am trying to see the value which goes into the NumeroProjet
property.
In order to do this, I have put the set;
on a new line and added a breakpoint here. When the debugger breaks the application on that line, I open the Locals
debugging window and verify the value of the value
variable (as the set
"method" uses hardcoded the variable value
, at least that's how I understand it).
This is what it all looks like:
As you can see, the value
equals zero, and when I do this multiple times, that variable never changes into something else.
This might mean two things:
NumeroProjet
is always equal to zero, and I must make sure that the correct input values are found.NumeroProjet
might be correct and I'm using the wrong way to check the value, put inside the NumeroProjet
variable.Which one is correct?
P.S.: at this moment I don't have the possibility to check the NumProjet
property afterwards.
It is easy to make a little test which shows that indeed the new value is displayed for value
in the locals window and that the break-point pauses the code execution after value
has been assigned:
By the way, it is a common practice to use the Framework name of a type when a static member is accessed like Int32.MaxValue
or Int32.TryParse
and to use the C# alias when used in a declaration: public int NumeroProject { get; set; }
. The reason is probably that a camelCase name looks wrong in static member access of a type: int.MaxValue
looks more like the access of a variable's member.