c# - Using async/await with pre-defined delegate signature -


The code is as follows:

  Fixed zero A () {string input = "Abcabcabc"; String pattern = "a"; String result = Regex. Change (Input, Pattern, Match => Evaluator (match)); } Fixed String Evaluator (match match) {return "D"; }   

Is there any way to use ASCNC / wait with a representative like this?

This:

  Fixed zero B () {String input = "abcabcabc"; String pattern = "a"; String result = Reggae Replay (input, pattern, async match = & aw; awkward; await for async match;); } Fixed async work & lt; String & gt; EvaluatorAsync (match match) {return "D"; }   

... does not work - the error message is 'The return type of an asynck method should be zero, work or work'.

The third parameter that you are going to Regex.Replace

    

You are going to a async representative whose redundant type is Task & lt; String & gt; . You can String result = Reggae. Change (Input, Pattern, Match => EvaluatorAynyn (match). Results);

But until the result is available, it will be blocked, which eliminates the purpose even further. Since reggae is highlighted in searches, the CPU is straightforward, so async will not help you there. You can do this to work in the background thread Task. Use to run.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -