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



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>