Introducing the Visual Studio 'C# REPL'

Sign in to queue

Description

The Interactive Window is an interactive environment that helps you quickly learn APIs, play with language features, and experiment with other .NET technologies by providing you with immediate feedback.

For more information, check out this course on Microsoft Virtual Academy:

Tags:

.NET, C#

Day:

1

Track:

.NET

Session Type:

On-demand Session

Code:

103

Embed

Download

Download this episode

For more information, check out this course on Microsoft Virtual Academy:

The Discussion

  • User profile image
    damir

    It would be cool if REPL editor would be able to extract script from interactive session and save it to file/clipboard.
    Right now, we would have to step through script and copy/paste code snippets.

  • User profile image
    ddobric

    It would be cool if REPL editor would be able to extract script from interactive session and save it to file/clipboard.
    Right now, we would have to step through script and copy/paste code snippets.

  • User profile image
    ddobric

    It would be cool if REPL editor would be able to extract script from interactive session and save it to file/clipboard.
    Right now, we would have to step through script and copy/paste code snippets.

  • User profile image
    karsten

    clickable resources link:
    https://github.com/dotnet/roslyn/wiki/Interactive-Window

  • User profile image
    karsten

    not clickable, but at least easy to copy

  • User profile image
    jspatton

    How is this different from this project which has been around a very long time?

    https://github.com/lukebuehler/CShell

  • User profile image
    Jason

    error CS1703: Multiple assemblies with equivalent identity have been imported: 'C:\WINDOWS\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll' and 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. Remove one of the duplicate references.

    Any ideas ?

  • User profile image
    Zkros

    Ok, Thanks

  • User profile image
    El Bruno

    Really cool sample !!!

  • User profile image
    DonaldA

    Nice, but I think you should embed LinqPad in Visual Studio/VSCode.

  • User profile image
    Changlin

    why not use F# repl?

  • User profile image
    kaseyu

    @Jason, what bits are you using? Let me know if you repro this on Update 1

  • User profile image
    Alex

    Does it support lambda expression evaluation?

  • User profile image
    Nakor

    Kasey - really nice intro! Well presented.

    I've been waiting for a decent REPL experience in .NET... so tired of creating ConsoleApplication634 to try something out.

    Thanks!

  • User profile image
    Odytrice

    I had a lot of excitement for the C# repl window, then I tried it and quickly lost interest. Partly because I currently use a tool like LinqPad and really like it, and also because I was expecting the C# Repl window to automatically load (or at least give a command to load) the current solution into scope with all the Classes and related Libraries ready to go.

    It would have made exploring a code base a delight. Not to mention the fact that you could use the repl while you are actively developing to experiment your ideas and then copy and paste the ones that work back into your solution. This is my current workflow with Linqpad for Linq Queries. I thought the C# REPL would be the ultimate tool for this workflow

  • User profile image
    Siderite

    What does Interactive C# use to display results? It's much better than the default "ToString" implementation and I would imagine it is easy to create a debug viewer that uses it.

  • User profile image
    kaseyu

    @Siderite: if you're curious, you can see the code in ObjectFormatter in the roslyn codebase. Carrying it over into the expression evaluators for the debugger is on our backlog. You can follow that work/discussion here (note the issues referenced at the bottom of the issue as well).

  • User profile image
    tsahi

    , jspatton wrote

    How is this different from this project which has been around a very long time?

    https://github.com/lukebuehler/CShell

    They have very similar capabilities, but CShell is a stand-alone application, while C# Interactive works inside visual studio.

  • User profile image
    Yann

    Very cool. Is there a way to save or export all the history as a script I could run again later?

    Thanks,

Add Your 2 Cents