I have simple code snippet from outside (backend server), basically simple mathematics, which I want to execute in Windows store/Windows phone universal application. This code changes state of static fields of one of my classes (set its values to some numbers). Is there any way to execute code from string in Windows Store / UWP app? I know about CSharpCodeProvider, but it seems absent in UWP. Just like most useful things.
Asked
Active
Viewed 281 times
2
-
Such an Eval() feature is always dangerous, that's why it's not standard. – H H Oct 13 '16 at 08:01
1 Answers
0
I don't think there's any out-of-the-box way, other than using Reflection
, but this might be tricky.
I've been experimenting with this a while back, but haven't done much in-depth testing. It's definitely enough for simple expressions and seems to have better performance than just using Reflection
.

Reynevan
- 1,475
- 1
- 18
- 35
-
I can't say I agree with everything you say and, you can evaluate strings up to 50 chars for free, and as far as I know there is no easy way to do it without third-party – Reynevan Oct 12 '16 at 18:50