Visual Studio Add-in for Quick Testing of a Code Snippet

One thing I really like about languages ​​like Python is that if you have a piece of code you want to try, you can just open up an interactive shell and do it in seconds.

Is there a Visual Studio add-in that does the same for C #?

Basically I'm looking for something that opens a window or tab with a text editor (preferably with code completion, because VS does it so beautifully) and a button that runs the code and displays the output. Additional points for convenience, such as displaying complex output in a user-friendly way (think Firebug console.log

), automatically referencing all assemblies associated with current projects, etc.

I searched for search terms for a long time but either couldn't find good keywords or nobody did an add-on like this. If they really don't exist, I plan to do it myself.

+2


a source to share


3 answers


I don't know about an add-on for VS, but anytime I want to try something quickly (and don't want to start VS and build a console app) I am using the Fragment Compiler . It gets the job done, how fast the testing methods are and what not. I usually use it for things like testing a regex or picking random date and time formats. You can add links to other assemblies and this provides some degree of intellisense.



+3


a source


LinqPad will execute C # snippets as well as LINQ. Nothing other than autocomplete is not included in the free version. Of course, you can write statements in VS with auto-completion and then copy / paste them in Linqpad.



+4


a source


I have a project test.vcproj

that sits around with a file test.cpp

where I am pasting the code. This is the best I could think of.

+1


a source







All Articles