Well, not really. Have you ever wanted to test a snippet of code without having to go through the whole process of creating a new Visual Studio.NET project though?

Well, now you can. Just compile the attached code, run the program, write the code and run it. It works with C# and VB.NET, just choose which one you want from the menu.

I'm not terribly gifted in the art of developing my own ideas for programs so I should mention that someone else has done this before. It is called the SnippetCompiler.

The program attached here is meant to be a no frills edit and run program so there is no syntax highlighting or printing or even editable references or compiler options yet. It does allow you to open and save snippets as well as redirect the output of the snippet to an output window within the application. If there are compiler errors double clicking them will bring you to the line that caused the error too.

Check it out if you are interested. I should mention that it comes with some prebuilt snippets and has been tested with a number of examples from the Framework SDK.

Just to highlight some of the new stuff, you can now choose which version of the framework to target, including 2.0, as long as the target version is installed. You can set a couple of compiler options and edit the references, including custom references to assemblies you may have written. Many of the settings will also be saved for use the next time the program runs (uses reboot's AppSettings class). Multiple instances can now be opened without affecting each other [Note: The last one closed wins as far as saved settings are concerned].

Here is the change log:
[Bugs fixed]
- Running a new snippet could cause a previously opened file to be overwritten. Fixed
- Console.ReadLine doesn't work for C# when commented out. Fixed for single line comments only
- Ctrl+V shortcut for Paste doesn't work. Fixed

[new features]
- User can select which version of the framework to target.
- Console.ReadLine warning will now bring you to the identified spot in the editor when you click cancel.
- Added an options dialog.
- Settings get saved for the following items:
- Redirect output
- Compiler
- Framework version
- VB Options
- CS Options
- References
- Tested to work with version 2.0 of the .NET framework.
- Multiple instances can now be used without interfering with each other.
- Removed the "~\out" directory and replaced it with a temporary folder in the PC's temp directory under a new GUID. This folder is removed when the application terminates without error.
- User can edit option explicit and option strict settings for VB compiler
- User can allow/disallow unsafe code for C#
- User can edit references to both built-in assemblies and custom assemblies.

Here is an updated version of my quick snippet program. I've fixed a couple of bugs and added some new features to make it more usefull. Note that this uses a custom control (source included) for the treeview explorer style navigation of saved snippets so you will need to build that before you can run the main program.

Here is the change log:
0.2.2
[bugs fixed]
- redirect standard output will hang if too much data is written to standard output.
- the warning for the Console.ReadLine should not be case sensetive for VB.

[new features]
- Allow saving of built assembly (build & save)
- Allow the snippet to be built as a console or windows app or class library (build & save only)
- Use a Treeview for easier navigation of saved snippets
- Changed error window to use a listview instead of a textbox
- Save window size, position, state, and size of left and bottom sections.

It allows you to store, access, and test snippets of VB.NET or C# code without having to open Visual Studio, or even have it installed on your machine. It is tested to work with all versions of .NET from 1.0 to 2.0 Beta.

It comes in really handy for me when posting an answer to a question here because I can easily test the code snippet before posting.

This is basically just one of those things I developed for myself and decided to share if anyone else was interested.