Martin Delille
Martin Delille

Reputation: 11780

See substring in debug watch

Is it possible to see a substring of a string when looking a string in the Watch window during a debugging session?

Upvotes: 0

Views: 410

Answers (3)

Jon Skeet
Jon Skeet

Reputation: 1500835

Yes - just watch

text.Substring(1, 15)

or whatever.

What happened when you tried this?

EDIT: "doesn't work" isn't really a description of what happened. I've just tried this myself in VS2008, and it worked fine. The value greys out when you step, but there's a little "refresh" button on the right hand side of the value box... when you click that, it will re-evaluate the expression.

If that's not happening for you, please describe what is happening for you.

Upvotes: 3

Joel Martinez
Joel Martinez

Reputation: 47749

sure, just put in a new watch entry with the substring you want to see :-

Upvotes: 0

Matthew Vines
Matthew Vines

Reputation: 27561

I tend to use the Immediate Window for this sort of thing, but as Jon Skeet has said you can also do it directly in the Watch Window.

Upvotes: 1

Related Questions