Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# callback parameter

Tags:

c#

A bit rusty in C#

I need to pass in a callback to a method:

void InvokeScript(string jsScript, Action<object> resultCallback);

In my class I have created a method to pass in to the method:

        public void callback(System.Action<object> resultCallback)
    { 

    }

Error message 1:

Resco.UI.IJavascriptBridge.InvokeScript(string, System.Action<object>)' has some invalid arguments

Error message 2:

cannot convert from 'method group' to 'System.Action<object>'

Thanks in advance

like image 812
Chris G. Avatar asked Aug 12 '26 13:08

Chris G.


1 Answers

Your callback should be:

public void callback(object value)
like image 181
Matthew Watson Avatar answered Aug 15 '26 06:08

Matthew Watson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!