Passing a callback function to another class

前端 未结 7 1380
小鲜肉
小鲜肉 2021-01-30 00:39

I\'m basically trying to pass a method to another class to be called later, but can\'t quite figure this out in C# (I\'m still too used to Objective-C).

public c         


        
相关标签:
7条回答
  • 2021-01-30 01:24

    Delegate is just the base class so you can't use it like that. You could do something like this though:

    public void DoRequest(string request, Action<string> callback)
    {
         // do stuff....
         callback("asdf");
    }
    
    0 讨论(0)
提交回复
热议问题