Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to see the elements of IEnumerable while debugging?

I am using an IEnumerable and in the debugger I would like to see the items that it has, but I can't because there is not any property neither items.

Is it possible to see the items that has the IEnumerable?

like image 561
Álvaro García Avatar asked May 05 '15 16:05

Álvaro García


3 Answers

Use the "local" window and expand the Results View.

like image 164
Mattias Avatar answered Oct 06 '22 11:10

Mattias


By doing what this instructs you to do:

enter image description here

I.e. click on those circular arrows on the left of the highlighted area.

like image 24
Alex Avatar answered Oct 06 '22 12:10

Alex


As an alternative to expanding the results view, you can, in the watch window, use the "results" format specifier.

For example, if the enumerable variable is named "myIEnumerable", type "myIEnumerable, results" into the name column of the watch window.

The minor benefit of the results specifier over expanding the results view is that it avoids showing the various enumerator properties, thus preserving screen real estate for the results.

like image 27
Brian Avatar answered Oct 06 '22 12:10

Brian