Metro Snack #2: What is WinRT?

What is WinRT?

What is WinRT?

It doesn't seem like a great idea to go into a series of posts talking about Metro-style apps without briefly defining the core components that they are built on.  The most fundamental piece of the puzzle for these apps is Windows Runtime, or WinRT for short.  WinRT is probably best described as an unmanaged, native API that can be leveraged from many different languages via a mechanism called language projection.  Read more to find out some more details about how WinRT works.

How does this thing work? (in a nutshell)


Since WinRT is designed to be a native API, it can't contain metadata directly in its code.  To get around this limitation, WinRT stores its metadata in .winmd files that are encoded using the ECMA 335 metadata format (CLI).  You might recognize this strategy if you're a .NET developer since this is what .NET does.  This enables things like reflection to be possible in WinRT.

object-oriented type system

Built on the metadata system is an object-oriented type system.  In this type system can be found a lot of things that could be found in the .NET framework.  There are also some new additions.  I won't go into details of what is or isn't in the WinRT APIs in this post as a) there are a lot and b) I'll be going into a lot of them in more detail as the series progresses.


Any class that is built to target WinRT is called a WinRT component.  Any WinRT supported language can be used to write a WinRT component.  Since it is built upon the metadata structure, a WinRT component written in one language can be easily used from another language.

What languages are supported?

Currently, the languages that are supported are C++(WRL and C++/CX), C#, VB.NET and JavaScript.  Technically, any .NET language can be used for WinRT development but only C# and VB.NET are supported for now.  Language projections can be created to expose the WinRT API to other languages in the future.

Give it a try

If you haven't tried it out yet, head over to the Windows Dev Center and download the Windows 8 Developer Preview.  Then, get started with Metro style app development. You'll need to choose whether to use XAML or HTML5 to build it.  I've got some tips to help you decide.