Is it possible to call c# Method from js?
Is it possible to call c# Method from js?
I want to recall C# while js catch error like below.
Util.InvokeScript(false, "eval", @$" try {{ // do something }} catch (error) {{ // call C# method }} ");
Is it possible to call c# Method from js?
I want to recall C# while js catch error like below.
Util.InvokeScript(false, "eval", @$" try {{ // do something }} catch (error) {{ // call C# method }} ");
Comments
Maybe LIQPad is not a right tool for a job? Or HTML? For example, you can create an application using Avalonia, and use it in LINQPad.
Or you can return some error value from
Util.InvokeScript
and call C# code.If you just want to log the error, you could call external.log (see the sample 'Adding JavaScript - logging'). Or you could return a value to the caller when there's an exception.
I want to recall c# method by user's SweetAlert select dialog
onClick
handler.Thanks, It works perfectly
This is a PoC, so for production use I'd wrap implementation details in the class. Nothing like this can be found in LINQPad examples...