Callback type not supported: System.Func`1[TResult]: Interop.ExecuteJavaScript("value=$0()", (Func<TResult>)myMethod)
Posted: Thu Aug 24, 2017 1:33 pm
I understand I can call a C# function from JS interop by calling
However, I need to be able to return a string, or an array, from my CS Function, so I tried replacing "Action" with "Func<string>" as seen below, but I receive the following error.
How do I pass a Value-Function, not an Action or void, to JS Interop?
Code: Select all
Interop.ExecuteJavaScript("$0()", (Action)myCSMethod)
However, I need to be able to return a string, or an array, from my CS Function, so I tried replacing "Action" with "Func<string>" as seen below, but I receive the following error.
Code: Select all
Interop.ExecuteJavaScript("alert($0())", (Func<string>)myGetStringFunction)
How do I pass a Value-Function, not an Action or void, to JS Interop?