Home How to pass async method delegate in async method call?
Reply: 0

How to pass async method delegate in async method call?

user660
1#
user660 Published in April 26, 2018, 1:45 pm

I have two async methods:

 private async Task<string> Method_1_Async(string parameter)
        { return await LongRunningFunction_1();} 
 private async Task<string> Method_2_Async(string parameter)
        { return await LongRunningFunction_2();}

I need to call them in a third async method passing the method name as a parameter. Something like this:

public  async Task<string> Method_3_Async(DelegateMethodClass methodName, string parameter)
        { return await methodName(parameter);}

How should DelegateMethodClass be declared? Thanks.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.429782 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO