Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run C# code using C# code?

Tags:

c#

i had asked earlier about the same kind of question but that was in java....
now for the knowledge, i want to know...

is it possible to run the one C# code using another C# code?

bcz i know C# is very powerful, so their might be some way to do this.

like image 991
Nitz Avatar asked Jun 04 '26 10:06

Nitz


1 Answers

It's the same sort of deal:

  • Compile the code, e.g. using CSharpCodeProvider
  • Execute the code, e.g. using reflection

If you download Snippy from the C# in Depth web site, you can see a smallish example of this - basically you type in snippets of C# and it can compile and execute them for you.

like image 183
Jon Skeet Avatar answered Jun 05 '26 22:06

Jon Skeet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!