concept asynchronous function in category c#

This is an excerpt from Manning's book C# in Depth, Fourth Edition.
Listing 5.9. Creating and calling an asynchronous function using a lambda expression
Func<int, Task<int>> function = async x => { Console.WriteLine("Starting... x={0}", x); await Task.Delay(x * 1000); Console.WriteLine("Finished... x={0}", x); return x * 2; }; Task<int> first = function(5); Task<int> second = function(3); Console.WriteLine("First result: {0}", first.Result); Console.WriteLine("Second result: {0}", second.Result);
C# 5 introduces the concept of an asynchronous function. This is always either a method or an anonymous function that’s declared with the async modifier, and it can use the await operator for await expressions.

This is an excerpt from Manning's book C# in Depth.
Listing 1.21. Displaying products in Windows Forms using an asynchronous function
private async void CheckProduct(object sender, EventArgs e) { try { productCheckButton.Enabled = false; string id = idInput.Text; Task<Product> productLookup = directory.LookupProductAsync(id); Task<int> stockLookup = warehouse.LookupStockLevelAsync(id); Product product = await productLookup; if (product == null) { return; } nameValue.Text = product.Name; priceValue.Text = product.Price.ToString("c"); int stock = await stockLookup; stockValue.Text = stock.ToString(); } finally { productCheckButton.Enabled = true; } }
Listing 15.9. Creating and calling an asynchronous function using a lambda expression
Func<int, Task<int>> function = async x => { Console.WriteLine("Starting... x={0}", x); await Task.Delay(x * 1000); Console.WriteLine("Finished... x={0}", x); return x * 2; }; Task<int> first = function(5); Task<int> second = function(3); Console.WriteLine("First result: {0}", first.Result); Console.WriteLine("Second result: {0}", second.Result);
C# 5 introduces the concept of an asynchronous function. This is always either a method or an anonymous function[2] that’s declared with the async modifier, and it can include await expressions. These await expressions are the points where things get interesting from a language perspective: if the value that the expression is awaiting isn’t available yet, the asynchronous function will return immediately, and it will then continue where it left off (in an appropriate thread) when the value becomes available. The natural flow of “don’t execute the next statement until this one has completed” is still maintained, but without blocking.