SyntaxEditor .NET Languages Add-on - Async/Await and Iterators

by Avatar Bill Henning (Actipro) - 1 comment
Wednesday, August 29, 2012 at 12:05pm

BlogPostBanner

The latest official C# 5.0 and Visual Basic 11.0 language specifications have added some new keywords and functionality to the languages.  Both languages add asynchronous procedure support (via async/await) and VB adds iterators.

Our upcoming 2012.2 versions of the SyntaxEditor .NET Languages Add-on (WPF and Silverlight versions) have been updated to fully parse the syntax changes and support automated IntelliPrompt on await expression results.

UPDATE:  Version 2012.2 is live and available for download now.

Automated IntelliPrompt for Await

Let's take a look at a sample of async/await in action.  In this sample code snippet, we have a method that will print the row count of a table that is asynchronously returned.

Async

Note how all variables are implicitly declared with the var keyword.  First we declare a dataTask variable that is a Task<DataTable>.  Then we declare a table variable that is the result of an await of the task.

A lot of complicated code is going on behind the scenes here.  First, in order to determine task's type, the resolver has to search the awaited object (dataTask) for a GetAwaiter method (either explicitly declared or declared via an extension method).  If found, it examines that object for a GetResult method and the return value of that is task's type.

Finally you can see from the screenshot that it properly determined that table is of type DataTable since we are able to access the Rows collection on it.

Summary

Our .NET Languages Add-on continues to support the latest syntax innovations and has very impressive automated IntelliPrompt capabilities that can be added to your own applications.  The enhancements mentioned above will be included in the upcoming 2012.2 version.

TaskDownload TaskLiveDemo TaskBuyNow

Actipro's WPF Controls

Over 100 UI controls for building beautiful Windows Presentation Foundation desktop apps.

Learn More

Over 100 UI controls for building beautiful Windows Presentation Foundation desktop apps.

Includes editors, docking windows, MDI, property grids, charts, tree controls, ribbons, gauges, themes, and much more.

Learn More Download Free Trial

Comments (1)

Posted 12 years ago by JesperTreetop
Avatar
Nice to see you so quick on the draw.

Add Comment

Please log in to a validated account to post comments.