Skip to content

JSMarshaller.BuildFromJSMethodExpression method

Builds a lambda expression for a JS callback adapter to a .NET method. When invoked, the expression will marshal the arguments from JS, invoke the method, then marshal the return value (or exception) back to JS.

C#
public Expression<JSCallback> BuildFromJSMethodExpression(MethodInfo method, 
    bool asExtensionMethod = false)
parameterdescription
methodThe reflected method info.
asExtensionMethodTrue to treat a static .NET extension method as an instance method call on the target JS object.

Remarks

The returned expression takes a single JSCallbackArgs parameter and returns a JSValue. For instance methods, the this argument for the JS callback args must be a JS object that wraps a .NET object matching the method's declaring type. The lambda expression may be converted to a JSCallback delegate with Compile.

See Also

Released under the MIT license