Reputation: 538
Is there a way of compiling C# code in C? I can do it in C#, but I'm not sure about how to do it, if you even can do it in C. Thanks :)
Note: Preferably C# (.NET)
Upvotes: 0
Views: 148
Reputation: 3775
You can load CLR into your process (it's a COM component), create the needed objects/interfaces from Sytem.CodeDOM
namespace and use them. But that's tedious, and I wouldn't recommend it.
Just call csc.exe
from your program.
Upvotes: 2
Reputation: 26209
C# code will be executed under CLR
( Common Language Runtime Engine) hence it is called ManagedCode
. CLR
creates proper execution environment for C# code to run properly. C Code is called UnManaged
Code as it does not run under CLR
. hence C# code can not be compiled in C.
Upvotes: 1
Reputation: 172578
No I dont think thats possible unless you are trying to prepare some compilers.
Upvotes: 2