How to make an Asynchronous Method return a value?

Generally asynchronous methods can have only void return types. If you wish to return some value use the following.

This will work only with C# 5.0.

 

 
The code snippet below works with versions lower than 5.0 too.

 

How to perform Async Task in Windows phone app

Asynchronous programming in Windows phone application adds two new keywords: async and await. This new feature is a simplified way of improving the performance of the app and making it more responsive to the user without the complexity of writing code to use multiple threads.

You can easily understand its use by the following example given below.

 

Example:

When you are retrieving data from a big database having hundreds of entries it may potentially take a second or two which adds to a degree of latency. So as to avoid it we may call this method under async task to avoid the delay.

 


 

So while the database entries are loading in the background you can perform any other function through your application at that moment of time.