Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inspecting values using the debugger in C#

How do I inspect the return value of this GetItems() function using the debugger? Do I have to create a local variable for the results to accomplish this?

foreach (string item in GetItems())
{
    // some code
}

private List<string> GetItems()
{
    // return some list
}
like image 729
JC. Avatar asked Jan 23 '23 06:01

JC.


2 Answers

You should be able to just add it as a Watch, and view the values as expected.

Debugging : The Watch Window

How to: Watch an Expression in the Debugger

like image 140
Adriaan Stander Avatar answered Feb 01 '23 07:02

Adriaan Stander


No, you can add a watch or a quickwatch to GetItems() and you would see the result

like image 25
Claudio Redi Avatar answered Feb 01 '23 08:02

Claudio Redi