13

Some programming language implementations provide a Read, Evaluate, Print Loop interactive shell to allow the programmer to evaluate expressions and program fragments, and to program in an incremental, interactive manner.

What implementations of a C# REPL have you used, and liked? It would be nice to have one that could integrate with Visual Studio as well.

I have found, but not tried, the Mono C# REPL and Don Box's C# REPL

1

6 Answers 6

5

Mono comes with a REPL tool called "csharp". I just tried it on Mac OS X and it works like magic. The only feature it currently lacks is Intellisense, promised to appear in Mono 2.6

4

Visual Studio 2008 includes REPL-like capabilities, though I wouldn't necessarily call them "good". I think they have the advantage of being included and always available--which can be handy when trying to do work at a workstation other than your own.

In Visual Studio, you can instantiate and invoke methods of objects using the Object Test Bench. You can also write interactive C# code (with many limits) using the Immediate Window (Debug->View->Immediate Window). Immediate Window can be used outside of a debugging session.

1

The best tool I've found for writing interactive c# code is the C# Snippet Compiler.

Not sure if it's exactly REPL but it is a great way to test out almost anything using C#/.NET.

It supports framework versions up to 3.5. It is not designed to integrate directly with Visual Studio, however it even provides its own intellisense.

Of course it's very easy to copy/export the code from this into your Visual Studio projects.

1

One that I've only seen is at the end of this video from PDC where Hejlsberg is going beyond C#4.

1
  • Awesome video. The part about using the compiler as a service starts at 59 minutes and 25 seconds into the talk, but the entire video is great. Anders is a really smart guy, and he gives a really good talk. Jan 21, 2010 at 5:44
0

I do not know of an interactive shell for running c# code snippets. There is one for the mono project, but I have not tried it: http://www.mono-project.com/CsharpRepl

I tried the C# snippet compiler, and it seems to be pretty much the same as creating a new console application in Visual Studio, but with limited intellisense, and none of the debugging features.

Right now I use the built in console application template anytime I want to try out simple input-output type experimental code. I use console Console.ReadLine() and Console.WriteLine() for input and output.

It actually works pretty well for me. I typically save all my little test programs so I can go back and find something I worked with a few months ago, and you get the full debugging features of Visual Studio.

0

Have you tried the VisualStudio C# REPL - O2 Platform (v5.1) plugin (more info at O2Platform question on 'Interactive development with Visual Studio' )

There is also the stand alone version C# REPL Script (see this readme for more details on the APIs https://github.com/o2platform/FluentSharp/blob/master/README.md )

Not the answer you're looking for? Browse other questions tagged or ask your own question.