+ 6

eval() in c#

hello. how i can do something like [ eval(); in js or php ] i will not make a text editor , but i need it in code only ! like : ๐ข๐ง๐ญ ๐ฑ = ๐ฌ๐ž๐œ๐จ๐ง๐ ; ๐ฌ๐ญ๐ซ๐ข๐ง๐  ๐Ÿ๐ข๐ซ๐ฌ๐ญ = "๐ก๐ž๐ฅ๐ฅ๐จ ๐ข'๐ฆ ๐จ๐ง๐ž"; ๐ฌ๐ญ๐ซ๐ข๐ง๐  ๐ฌ๐ž๐œ๐จ๐ง๐ = "๐ก๐ž๐ฅ๐ฅ๐จ ๐ข'๐ฆ ๐ญ๐ฐ๐จ"; ๐ฌ๐ญ๐ซ๐ข๐ง๐  ๐ญ๐ก๐ข๐ซ๐ = "๐ก๐ž๐ฅ๐ฅ๐จ ๐ข'๐ฆ ๐ญ๐ก๐ซ๐ž๐ž"; ๐ฌ๐ญ๐ซ๐ข๐ง๐  ๐Ÿ๐จ๐ฎ๐ซ๐ญ๐ก = "๐ก๐ž๐ฅ๐ฅ๐จ ๐ข'๐ฆ ๐Ÿ๐จ๐ฎ๐ซ"; ๐Ÿ๐ฎ๐ง๐œ(๐ฒ); { ๐ž๐ฏ๐š๐ฅ(" ๐ฑ = " + ๐ฒ); } func(x); ๐œ๐จ๐ง๐ฌ๐จ๐ฅ๐ž.๐ฐ๐ซ๐ข๐ญ๐ž(x); // ๐จ๐ฎ๐ญ๐ฉ๐ฎ๐ญ : ๐ก๐ž๐ฅ๐ฅ๐จ ๐ข'๐ฆ ๐ญ๐ฐ๐จ ---------------------------- i need code like this because i have more than 50 if else and switch blocks and more. thanks =) i try the idea here : https://code.sololearn.com/WbiEHdk01g4l/?ref=app

31st Jul 2018, 12:29 PM
Yousef Eabitan
Yousef Eabitan - avatar
2 Answers
+ 2
It can be achieved using System.Data.Compute() method. However I'm not sure if it can do string operations. You can refer the Execute function in the following code to get an idea on how to use it (last method in file). https://code.sololearn.com/cUjWf1uegwh6/?ref=app
31st Jul 2018, 5:31 PM
Rusty.Metal
+ 3
Rusty.Metal Thank You , Yes I Need Something Like This , But I Will Try If This will work with me โคโค
1st Aug 2018, 1:12 PM
Yousef Eabitan
Yousef Eabitan - avatar