Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamic C# code execution

Tags:

c#

I need to run small snippets of C# code for educational purposes and for each execution, I should open the project (solution), delete existing code, type new code, build and compile, and then run the project. For example, for executing string.IsNullOrEmpty("something") I should follow all this procedure. I just thought of something like:

enter image description here

In which I can enter code snippets, click execute, and then see the result. Is there anyway to do that?

like image 442
Saeed Neamati Avatar asked Feb 07 '26 00:02

Saeed Neamati


2 Answers

You didn't explicitly state if you're looking for guidance on implementing your own solution or what, but if you're open to using a third party utility then LINQPad is pretty much exactly what you're describing.

like image 118
Brandon Moretz Avatar answered Feb 08 '26 15:02

Brandon Moretz


Take a look at Snippet Compiler.

Not exactly what you're asking for, but from what I can tell it seems pretty close.

like image 30
Steven Evers Avatar answered Feb 08 '26 13:02

Steven Evers



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!