tags:

views:

361

answers:

4

I need a programming language to make tiny applications. As a C++ programmer, I think C++ is not practical for this purpose, because it takes too much effort to create a new application from scratch and to deploy it. However, I'd like to use a language equally powerful, so I was wondering whether C# can be used as a scripting language?

+11  A: 

Read this one

CS-Script - The C# Script Engine

CS-Script is a CLR (Common Language Runtime) based scripting system which uses ECMA-compliant C# as a programming language. CS-Script currently targets Microsoft implementation of CLR (.NET 2.0/3.0/3.5) with limited support on Mono.

CS-Script is an open-source initiative that is distributed under the license agreement, which can be found here. However commercial support is also available.

CS-Script combines the power and richness of C# and FCL with the flexibility of a scripting system. CS-Script can be useful for system and network administrators, developers and testers. For any one who needs an automation for solving variety of programming tasks.

and

Treating C# Like A Scripting Language

rahul
good answer. Right on the nail!
Preet Sangha
+4  A: 

I would say that the usual benefits of a scripting language are:

  1. It normally has a command line interpreter
  2. You don't necessarily have to compile it
  3. It's easy to change the code - because the source file is the actual 'executable'

These are not features of C#, so a language that can do pretty much all that would be powershell, as it uses .net so it has access to all the features you might use in c#.

Dave Arkell
Mono provide a repl for C# (see link in my answer)
mavnn
+4  A: 

You could try Python, which is both a very understandable and powerful language. It is possible to parse/execute Python from many languages.

For example: Use SWIG to use C++ code in Python or Boost to embed Python code in your C++ app.

Tarnschaf
Agreed. If the OP wants the strength of the .NET framework, IronPython is readily available.
Marc Gravell
+2  A: 

An other useful tool if you want to use C# for scripting is http://www.mono-project.com/CsharpRepl : a C# interactive prompt from the mono team.

I'd say that Mono in particular provides all of the tools to use C# as a very effective scripting language, and nearly anything you write in will run fine in .net if thats your main target environment.

mavnn