简体   繁体   中英

C# Compiler in C?

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)

不,除非您尝试准备一些编译器,否则我认为这不可能。

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM