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.
精彩评论