开发者

Are there design-time watch windows for Visual Studio 2008/2010?

开发者 https://www.devze.com 2022-12-31 19:45 出处:网络
There are many times when I need to test a little snippet of .NET code but rebuilding and publishing the entire project or writing a suite of unit tests just seems like overkill. For example, I am wri

There are many times when I need to test a little snippet of .NET code but rebuilding and publishing the entire project or writing a suite of unit tests just seems like overkill. For example, I am writing a regular expression right now and I want to see if the pattern is matching on the right parts. I could go and find a million other utilities that do that sort of thing, but that is not exactly my point.

Firebug has an exact analogue to what I want - the Firebug console. There is a text box where the user can enter some JavaScript and Firebug will execute it on the spot and display the return value.

I would love to be able to enter something like (new Regex("b+")).Replace("abc", "x") and see the results without having to do all the overhead. Does Visual Studio have anythin开发者_运维知识库g like this?


In the Command Window (Ctrl+W, A) you can do simple expressions like

>? "foo".Replace("o", "O")
"fOO"

To test a snippet of any real size, I Alt+Tab over to LINQPad.

0

精彩评论

暂无评论...
验证码 换一张
取 消