❔ compile at runtime
Is there any way to check if a string is actual c# code and if it is to compile and run it at runtime?
6 Replies
You can use Roslyn for that.
NuGet package: https://www.nuget.org/packages/Microsoft.CodeAnalysis.CSharp/
Tutorial: https://joshvarty.com/2016/01/16/learn-roslyn-now-part-16-the-emit-api/
Thanks
And if you have questions, #roslyn exists 🙂
recently I have used to evaluate C# expression for my decision tree project here https://github.com/dotnet/roslyn/blob/main/docs/wiki/Scripting-API-Samples.md
Thank you
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.