BT
x Your opinion matters! Please fill in the InfoQ Survey about your reading habits!

CSI C# Interpreter Supports .NET 4.0

by Al Tenhundfeld on Jan 12, 2010 |

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

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

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2014 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT