How to quickly code and run small C# code
Snippet Compiler is great for this.
LINQPad is also good for testing out all sorts of C#, F# or VB code, not just LINQ queries.
EDIT
I suppose it's time that I mention that Snippet Compiler hasn't been updated in over five years, and is therefore no longer the best option.
However, I undersold LINQPad originally. As Will Dean mentioned in the comments, LINQPad is excellent for all sorts of code, not just LINQ queries. In fact, it has become an indispensable tool for me. I use it daily, not only to quickly test out short snippets, but for relatively complex mini programs. Its advanced output formatting makes it extremely easy to quickly examine intermediate and final results.
A bit late to the party, but I came here while searching for this myself.
The best suitable solution for me was using the C# Interactive
-window inside Visual Studio 2015 or later.
You can access it by opening it via View
> Other Windows
> C# Interactive
, or by selecting some c# code and clicking on Execute in Interactive
in the right-click context menu.
Here is a link on how to use it: http://dailydotnettips.com/2016/01/12/use-c-interactive-window-for-your-coding-experiment-in-visual-studio-2015/
I know it works in VS2015, I don't think it works in older versions.