BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

CSI C# Interpreter Supports .NET 4.0

| by Al Tenhundfeld on Jan 12, 2010. Estimated reading time: 1 minute |

CSI is a simple C# interpreter that allows command-line compilation of standalone C# files. A new version has been released that supports .NET 4.0.

CSI accepts an input file and compiles the source code on the fly, finally executing the resulting assembly. This allows with a simple, self-documenting batch file with no project files and no concern for the resulting binary and keeping code changes synchronized.

Sample batch file Hello.cs :

public class Hello
{
	public static void Main()
	{
		System.Console.WriteLine("Hello World");
	}
}

Sample usage:

C:\>CSI Hello.cs
Hello World

There are many options for writing scripts and batch files in the Windows environment, including PowerShell which can also leverage the .NET framework. However, because it is open source, CSI offers more customization of behavior and can support new .NET and C# features more quickly.

CSI 4.0, the version targeting .NET 4.0 relies upon .NET 4 Beta 2 Framework. This version allows scripters to take advantage of the new dynamic type, the push-based IObservable interface, the Tuple class, among the many new features in C# 4.0.

CSI also includes a command script to register the .CSI file type with Windows to execute C# batch files without dropping into a command-line interface. CSI makes executing batch files straightforward with features including executing multiple files in one command and specifying custom references. But CSI is not an interactive shell, not a REPL.

For a true interactive C# shell, like Ruby's IRB, there are other projects providing a REPL compiler service, including the Mono project CsharpRepl

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and dont miss out on content that matters to you

BT