Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

CShell, the open source C# REPL IDE

Sometimes you just need to play with a few lines of C#. You need to try something out, see the results of a quick execution, etc. And you need to wash-rinse-repeat, to build on your just run, add a little more, run it, add more, etc. You need to REPL, to read-eval-print-loop.

Sure you can do this in LINQPad or fire up a Visual Studio project, but neither are really REPL and can be a little overkill. And since you're here, I'm sure you'd also like to see behind the curtain, to not only play with the binary, but see how what goes into the binary, i.e. the source.

I found today's project via Alvin Ashcraft's awesome blog, Dew Drop and post Dew Drop - May 15, 2014 (#1777). If you only have a few minutes a day to scan what's new, Alvin's blog is one of those must read resources.

Now, on with the...

CShell

CShell is an interactive C# scripting environment. It allows you to use C# without any fluff right in a console like environment called a read-eval-print-loop (REPL). Your code is directly evaluated and executed in a shell window, no separate executable has to be compiled and then run in a different process. More elaborate code can be written in a C# script and then evaluated as one file, only one line, or a selection. Then, your results can be easily dumped to HTML (like LINQPad) or viewed as a data grid or plotted to a chart.

CShell is perfect to explore data and quickly drill deeper into information since you can write one line of code, evaluate it, check out the results, and then write some more code, evaluate it again, and so forth.

If you just want to test one or two lines of C# code without creating a new console project in Visual Studio just fire up CShell, type the code you wanna test and you immediately can see if it works the way you want.

...

Why CShell?

We developed CShell because we needed it for ourselves. Visual Studio was often too heavy weight and LINQPad has no REPL loop. What if you load 2-3 GB of data and then wanna start exploring it, without having to load all the data every time the program is executed? With a REPL loop this is possible. Also we felt the time is ready for a more mature C# scripting environment with projects like NRefactory, Mono.CSharp and Roslyn quickly filling the gaps that remained to realize such a project.

I grabbed the latest code drop, which compiled and ran with no problems...

image

Here's a snap of the Solution;

image

So what are the features of CShell? Glad you asked...

Features
  • Read Eval Print Loop (REPL): Evaluates C# code on the fly (built using Mono.CSharp). Includes code completions right in the command line.
  • C# Code Editor: A powerful editor with code completion that supports C# scripts (.csx files) and normal C# (.cs) files and many more file types. Code from the scripts can be directly sent to the REPL.
  • Workspace Explorer: The place to keep all the scripts and other files organized, manages references, and edit the ".cshell" file, in which the whole CShell IDE can be configured using C# code (not XML).
  • Sinks: Out of the box there are several ways of viewing any resulting data: Simple console output, LINQPad like XHTML dump, data grids, and plotting.
  • Extend CShell: The whole project was built with extensibility in mind, modules that add new editors or sinks and more can be quickly developed and loaded in CShell.

I wonder how/when/if Roslyn will impact this project. Guess we'll have to wait and see. But since it is open source, I guess we could drive that ourselves! :)

If you've been looking for a C# REPL environment, one that's also open source, you've got to check out CShell...



Tags:

Follow the Discussion

  • This is awesome! I've been looking for something quick and easy like this as well!

  • Jon DavisJon Davis

    Isn't there already a C-Shell (csh)?

  • Thank you for pointing us to this and has some very interesting source as well.

    I would suggest everyone check out the Morning Dew blog mentioned in the article it is a must read everyday.

  • XpndableXpndable

    Couldn't you do this in PowerShell? It has all of the .NET functionality for REPL without needing a 3rd party application. Perhaps I've overlooked something...

  • @Xpndable: Yeah, the fact that the REPL is a PowerShell REPL and not a C# REPL. Both may be using the .NET framework, but usage patterns are quite different. You can't learn C# by programming in VB.NET, which is really the equivalent of what you're suggesting.

  • organicitorganicit

    Nice but there is already scriptcs http://scriptcs.net which is already well under development and adoption. It would be awfully dumb to have competing REPL's. I would advise the author of this project to stop now, and just contribute to scriptcs which is OSS and available for contribution on github.com.

  • This project is sponsored by a hedge fund. Bizarre.

  • @organicit: well we are merging efforts with ScriptSc, but keep in mind that ScriptCs has only a command line REPL. 

    CShell is a WPF app, from the REPL you have access to the UI shell, you can plot easily, dump data (quite like LINQPad), and so on. Also, since it's WPF and uses AvalonEdit, we can have VS like code completion.

    If you look at ScriptCs branch, you'll be able to see that we are switching to use ScriptCs under the hood.

  • @cbae: why bizzare? :) Many hedge funds use .NET technologies, having to switch constantly between R and Matlab and our own C# financial libraries get's cumbersome. Now we can load our data in a C# environment, explore it, run back-tests, and quickly deploy new ideas.

    A big issue for us has always been the need to keep large amounts of data in memory, without constantly restarting the program. CShell allows us to do that.

    Plus, CShell, is built on awesome opensource projects, like NRefactory, AvalonEdit, AvalonDock, Caliburn.Micro... why not give back?

  • Greg Duncangduncan411 It's amazing what a professional photographer can do...

    @lukebuehler: And thank you for giving back! :)

Remove this comment

Remove this thread

close

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.