0

I have code in html:

function analyze(t){
    t=t.split("");
    t=t.slice(3);
    t=t.slice(2);
    return t.join("")
}

And i download this code from the internet(the code is changing and it make some changes on a string).

And i want to know if there is a way to run this code in C# without WebView and in synchronous. The code is in javascript.

3
  • 1
    Why not just write it in C#? Commented Aug 27, 2013 at 13:33
  • Because i run a program that need to run some analyze on a string.And the analyze may change Commented Aug 27, 2013 at 13:34
  • surely it would be easier then to to write the string in C# and use compiler services to compile and execute it? Commented Aug 27, 2013 at 13:40

2 Answers 2

2

You can use jint to execute JavaScript from .NET. It's a fully functional js interpreter providing functionality for calling js-Code from .NET and vice versa.

Sign up to request clarification or add additional context in comments.

Comments

0

You can use Microsoft.JScript to evaluate JavaScript.

Here's an example on how to do that: http://odetocode.com/articles/80.aspx

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.