Reflection API Changes For Windows Store Apps

| by Roopesh Shenoy Follow 0 Followers on Aug 31, 2012. Estimated reading time: 1 minute |

.NET API subset for Windows Store Apps is considerable smaller than the full .NET Framework 4.5. Particularly, Reflection.Emit is not available and most members in the System.Type class have been moved to the System.Reflection.TypeInfo class.

The .NET Team has split System.Type into two classes – System.Reflection.TypeInfo and a reduced System.Type – to mainly separate the concerns of type definitions and type references. This kind of separation already existed when dealing with Assemblies. Brandon Bray explains in the article Evolving the .NET Reflection API -

The System.Reflection.Assembly class represents assembly definitions, whereas the System.Reflection.AssemblyName class represents assembly references. The former exposes rich functionality, and the latter is just data that helps you get the definition should you want it. That’s exactly the model that we wanted to adopt for System.Type.

The Type will only provide a reference to a Type and does not load all the metadata about the type itself. All the rich information of a Type is now within TypeInfo – given a Type you can get the TypeInfo of that type for accessing the metadata. The advantage of this, is that accessing the Type object does not require loading the necessary assembly – that is needed only when accessing the TypeInfo class. This means the control of whether loading an assembly is needed is now with the developer depending on what she wants to achieve.

The Reflection API also starts using IEnumerable instead of Arrays as the return type for most of the methods for better working set and responsiveness.

Compatibility: The new Reflection API is not a breaking change – using the new model is mandatory for Windows Store Apps, but for code targeting .NET Framework 4.5, you can use both the earlier (.NET 4.0 model) or the new model for Reflection. To achieve this, the .NET Framework types use a slightly different type hierarchy. In case you intend to reuse your reflection code between .NET 4.5 and Windows Store apps, Microsoft recommends that you package that as a Portable Class Library

Rate this Article

Adoption Stage

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread


Login to InfoQ to interact with what matters most to you.

Recover your password...


Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.


More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.


Stay up-to-date

Set up your notifications and don't miss out on content that matters to you