Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is C# suitable for a scripting language? [closed]

Tags:

c#

scripting

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?

like image 419
Dimitri C. Avatar asked Sep 29 '09 10:09

Dimitri C.


People also ask

What is %d in C programming?

In C programming language, %d and %i are format specifiers as where %d specifies the type of variable as decimal and %i specifies the type as integer. In usage terms, there is no difference in printf() function output while printing a number using %d or %i but using scanf the difference occurs.

Is C+ Same as C?

C++ was developed by Bjarne Stroustrup in 1979. C does no support polymorphism, encapsulation, and inheritance which means that C does not support object oriented programming. C++ supports polymorphism, encapsulation, and inheritance because it is an object oriented programming language. C is a subset of C++.

What does %c mean in C?

%d is used to print decimal(integer) number ,while %c is used to print character . If you try to print a character with %d format the computer will print the ASCII code of the character.

Is C -- a language?

C-- (pronounced C minus minus) is a C-like programming language. Its creators, functional programming researchers Simon Peyton Jones and Norman Ramsey, designed it to be generated mainly by compilers for very high-level languages rather than written by human programmers.


4 Answers

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.

like image 187
Tarnschaf Avatar answered Oct 15 '22 05:10

Tarnschaf


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.

like image 23
mavnn Avatar answered Oct 15 '22 07:10

mavnn


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

like image 18
rahul Avatar answered Oct 15 '22 05:10

rahul


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#.


Edit: Just to resurrect this one from the dead...

Had a chat with a colleague, after thinking a bit about scripting languages that I have used like Ruby and Python.

One of the most important features for me in a scripting language is the ability to have code run directly in the script, without needing a main function. You don't do this in c#. However you do this in all the scripting languages that come to my mind:

eg, Ruby, Python, Javascript, Powershell

like image 5
Dave Arkell Avatar answered Oct 15 '22 05:10

Dave Arkell