-1

I am using visual studio community 2015. Now when I need some debug info I am using System.Diagnostics.Debug.WriteLine. I would like to know if there is a way to do the same with objects/classes like in javascript's console.dir()

For example

someObject = { x: 1, y: true, z: "some text"}
console.dir(someObject);

give me

console.dir()

I like to get this info to check (for example) parameters that I send to event handlers functions.

Thanks

Community
  • 1
  • 1
distante
  • 6,438
  • 6
  • 48
  • 90

1 Answers1

1

The community edition has immediate pane and code insight. So you can do this:

Screenshot of VS debugging session, red circles included

  1. Open the immediate pane (Debug > Windows > Immediate) and type the name of the object to dump.

  2. Step past the first assignment, then hover the mouse pointer over the identfier. A popup (that can be pinned) opens. You can drill down if the object has multiple "levels", just like in console.dir.

Cee McSharpface
  • 8,493
  • 3
  • 36
  • 77
  • Ah!! I have to always use a break point for be able to look it don't I ? In run mode (I think that is the name) it will not work? – distante Jan 08 '17 at 18:43
  • If you need a non-interactive version, [consider this](http://stackoverflow.com/q/4504249/1132334) or this, as previously suggested in a comment on the OP: http://stackoverflow.com/a/360309/1132334 – Cee McSharpface Jan 08 '17 at 18:44
  • Yes, I was looking to that post too, thank you for your help. I get in almost my c# question down votes :/ – distante Jan 08 '17 at 18:50