Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: Possible to get string content of passed in function?

$
0
0
Greetings!

I was wondering if it is possible to pull the string content of a passed in JavaScript function

Do you mean the function's JavaScript source code? If so, then you can use JavaScript's Function.prototype.toString():
publicvoid execute(dynamic function) {
    string sourceCode = function.toString();
    Console.WriteLine(sourceCode);
}
Cheers!

Viewing all articles
Browse latest Browse all 2297

Trending Articles