C# Console/CLI Interpreter?

后端 未结 17 2015
眼角桃花
眼角桃花 2020-12-24 07:57

I wonder if there is something like a standalone Version of Visual Studios \"Immediate Window\"? Sometimes I just want to test some simple stuff, like \"DateTime.Parse(\"bla

17条回答
  •  感动是毒
    2020-12-24 08:04

    C# Interactive window and csi.exe REPL were added to Visual Studio 2015 Update 1:

    Introducing Interactive

    The Interactive Window is back! The C# Interactive Window returns in Visual Studio 2015 Update 1 along with a couple other interactive treats:

    • C# Interactive. The C# Interactive window is essentially a read-eval-print-loop (REPL) that allows you to play and explore with .NET technologies while taking advantage of editor features like IntelliSense, syntax-coloring, etc. Learn more about how to use C# Interactive on Channel 9 or by reading our beginner’s walkthrough.

    • csi. If you don’t want to open Visual Studio to play around with C# or run a script file, you can access the interactive engine from the Developer Command Prompt. Type csi /path/myScript.csx to execute a script file or type simply csi to drop inside the command-line REPL.

    • Scripting APIs. The Scripting APIs give you the ability to execute snippets of C# code in a host-created execution environment. You can learn more about how to create your own C# script engine by checking out our code samples.

    See What’s New in Visual Studio 2015 Update 1 for .NET Managed Languages.

    Basically, now you have:

    • IDE REPL — C# Interactive window in VS
    • Script interpreter — csi foo.csx from Dev Cmd Prompt
    • Command line REPL — csi from Dev Cmd Prompt
    • Scripting API

提交回复
热议问题