Baruch
Baruch

Reputation: 21508

C# (language only) compiler

I am looking for an option to compile C# syntax to native code (or maybe to C++?). I am not interested in having all the libraries that are officially part of the language, just being able to write programs the same as I write my C++ programs, but using language constructs such as partial classes, properties, lambdas, generics, etc.

  1. Is there such a thing?
  2. If there isn't, is such a thing even possible, or am I misunderstanding something fundamental about C#?

Upvotes: 2

Views: 201

Answers (3)

phoog
phoog

Reputation: 43046

The standard csc.exe compiler can compile without using the BCL. See the reference for the /nostdlib switch: http://msdn.microsoft.com/en-us/library/fa13yay7.aspx

In part, it says:

"Use this option if you want to define or create your own System namespace and objects."

Silverlight projects use this, for example.

Upvotes: 0

user703016
user703016

Reputation: 37945

Possibly the closest thing to what you want is the Vala programming language. It is heavily inspired by C# and compiles to C, which is then compiled by a traditional C compiler.

It has partial classes, properties, lambdas, generics, etc, as you say, but it's not C#.

Also check out IL2CPU which translates IL to machine code. Maybe it can be used on .NET assemblies.

Upvotes: 6

BLUEPIXY
BLUEPIXY

Reputation: 40145

perhaps

NGen.exe

see

Upvotes: 0

Related Questions