Category: C#

BING Maps integration

Follow the below steps to Integrate BING Maps in your ASP.Net application Step1: Create a C# ASP.NET Empty Web Application in Visual Studio 2010. Step2: Add a Default ASP.NET page into the application. Step3: Add a table to the page with two cells in a row. The left cell is for Bing Maps and the

Context based Asynchrony

Asynchronous methods depend on their context for the exact semantics of their resumption after an await. A UI context is usually single threaded, which means that only one asynchronous operation can be executing on it at any given time. This is very useful in a stateful environment such as a UI, because less care needs

Asynchronous lambda expressions

Not only methods but also lambda expressions can be async. Among other things this allows event handlers to be anonymous: sumButton.Click += async (sender, e) => { sumButton.IsEnabled = false; await SumPageSizesAsync(GetUrls()); sumButton.IsEnabled = true; }; AddHandler sumButton.Click, Async Function(sender, e) sumButton.IsEnabled = False Await SumPageSizesAsync(GetUrls()) sumButton.IsEnabled = True End Function Another useful application of

Event handlers and void returning async methods

Async methods can be built from other async methods using await. But where does the asynchrony end? What kind of top level synchronous methods call asynchronous ones to start with? In a client application the typical answer is that asynchronous operations are set off by events. The user clicks a button, and an asynchronous activity

Async methods and awaiting in detail

It is important to understand that async methods like SumPageSizesAsync do not run on their own thread. In fact if you write an async method without any await’s in it, it will be completely synchronous: public async Task<int> TenToSevenAsync() { Thread.Sleep(10000); return 7; } Public Async Function TenToSevenAsync() As Task(Of Integer) Thread.Sleep(10000) Return 7 End
SiteLock