Anders Hejlsberg's C# 4.0 REPL

Viewed 11514
10 Answers

The REPL demo was part of "what might happen next", i.e. after 4.0; in .NET 5.0 or something similar.

This is not 4.0 functionality, and never has been.

The Immediate window (Debug>Windows>Immediate Ctrl+D, I ) is fairly good replacement that's built in. It does require you start the IDE and put a breakpoint on something.

It does give you the context of where you would like to do experimentation.

Marc's answer is entirely correct, the possibility of a repl or script like c# has been discussed by Eric Lippert in two blog posts:

I would add that, the 2010 CTP does contain an f# repl (not much use for c# but if you were interested in some aspect of the BCL or CLR then it might be sufficient for your needs)

I find that LINQPad makes up for the lack of a REPL in many cases. It would be nice to get it integrated into Visual studio so you could interact with your existing code base more easily though.

From time to time I want to try out some .NET API instead of wondering about C# language syntax. (There are far more subtleties in API than in the language itself.) If you are only looking for REPL for .NET, good old PowerShell is always with you.

C#:

using System;
using System.Text;

Convert.ToBase64String(Encoding.UTF8.GetBytes("Overflow"));

PowerShell:

[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes("Overflow"))
Related