What are WinRT language projections?

2019-02-04 09:47发布

问题:

What are WinRT language projections and what are they used for?

回答1:

Windows Runtime Projections are the way that the Windows Runtime APIs are exposed in each language. This may be at compile time (as in C++) or at runtime (as in JavaScript) or a combination (as in C#). Each language decides how to present the WinRT APIs best. Most of the time it is a direct exposure, but other times there are wrappers or redirections that may take place. Delegates and events are a good example. In C# they show up as C# delegates/events and not as WinRT-specific types. Strings likewise are remapped to be the native language string type and not the underlying hstring type.



回答2:

"Projections" in WinRT is another word for "Bindings".

The WinRT Language Projections are the WinRT Bindings for each Language that is supported.

For more information, check out:

WinRT Demystified - Miguel de Icaza



回答3:

The easiest way to clarify is that a language projection in WinRT is the "front end" whereas the Windows Runtime is the backend. Write from one of the three languages (JS, C#, VB), it behaves identically on the back end.

If you write your own 3rd Party WinRT component in C++ or C#, you can use it from JS, C# and VB without having to do any extra work.