Chapter 13. Async in WinRT Applications
For those who aren’t already familiar with WinRT, I’ll give a brief overview of the technology before moving on to explore how async and WinRT work together.
What Is WinRT?
WinRT (or Windows Runtime) is a group of APIs that are used in Windows 8 applications that run on Windows 8 and Windows RT for ARM processors. One of the design goals of the WinRT APIs is responsiveness, achieved by asynchronous programming. All methods that could take longer than 50ms are asynchronous.
It is designed to be used uniformly from three completely different technology stacks: .NET, JavaScript, and native code (usually C++). To achieve this, the APIs are all defined in a common metadata format called WinMD. Each of the languages can then compile against the WinMD definition of the API, without any need for a language-specific wrapper. This system is called projection, where each compiler or interpreter projects the WinRT type to be used as a normal type in the language.
Note
WinMD is based on the .NET assembly metadata format, so the constructs that are available are very similar to .NET: classes interfaces, methods, properties, attributes, etc. There are differences, though; for example, generic types are legal, but generic methods aren’t.
The majority of WinRT is implemented in native code, but you can also write WinRT components in C#, which you or others can then consume from any of the supported languages.
Because the WinRT interfaces are not .NET, the API provided ...
Get Async in C# 5.0 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.