How can i compile code, that is located in variable string?
How can i compile code, that is located in variable string? i asked this question to chat gpt and google geminш, but they gave me only only these options that didn't work
36 Replies
and i using visual studio(if this information is need)
$code
To post C# code type the following:
```cs
// code here
```
Get an example by typing
$codegif
in chat
For longer snippets, use: https://paste.mod.gg/um, here's need to show that this code is wrong
and gives an error
he is asking you to post the images as code so we can better read it and if needed copy paste, modify etc
uh ok, wait
and..
where is ScriptEngine coming from? what library
because of that it didn't work
and Gemini didn't write this library
I know this one
this uses
gives errors
(translated to english)
👆
u have to add the nuget
i've forgotten how
i remember i did this few times but.. could you remind how😅
im not near a pc ... mmm u right click your project then some where there u see nuget or package manager or something
mhm, found it
this? right?
yea, it works
so now i need to edit and paste it to my project😅
no worries glad its working 😉
ScriptEngine was something very old I think
I remember seeing it but dont remember where
if it works consider $close this thread 🙂
Use the /close command to mark a forum thread as answered
here's anyways too many code...
sorry i've been afk
but with ScriptEngine it looks shorter
I dont know what Script Engine is
so I can't help u with that
Internally Script Engine also uses lengthy code. 🙂
https://github.com/suugbut/SuperTrashBin/blob/main/instantiate_from_text_file.cs
I'll check it later
if you can link me to what ScriptEngine I might be able to help
Lengthy.. you mean in string can be longer code?
Script Engine only shortens the boilerplate.
Ah there is Microsoft.CodeAnalysis.CSharp.Scripting
which lets u evaluate code with your code
if that is what you're referring to
I'll try it tomorrow, maybe I just didn't install the right library for this
I didn't fully understand you.. sorry...
give me a second
u need
using Microsoft.CodeAnalysis.CSharp.Scripting;
for that, nugetOk, thank you, i'll try it tomorrow
If something will go wrong, i'll write
i've installed this, but it anyways gives errors ._.
guuuuuys, heeeeeelp @leowest @always use bool? as primary keys
What do the errors say?
wait a sec
wait what
why it works??
it didn't work just now