Calling Async Method Repeatedly in C#

When an async method needs to be called repeatedly, we need to take care of a few things. If all the data members & processing is within one method with all local variables, we could just use it as any other method. But if there are different private members, global within the class, we need to make sure that one method call doesn’t overwrite the values of those members set by previous call.

Using a queue will solve this problem. Download and go through the example here. It is a console application which calls an async method to add up 2 numbers repeatedly in a loop.

Feedback & Suggestions welcome.

Share This!

Leave a Reply

Your email address will not be published. Required fields are marked *