.NET mappings of Windows Runtime types in UWP apps
Άρθρο
This article lists the mappings that .NET makes between Windows Runtime (WinRT) types and .NET types in Universal Windows Platform (UWP) apps written with managed code. In these apps, Visual Studio IntelliSense shows the .NET type instead of the WinRT type. For example, if a WinRT method takes a parameter of type IVector<string>, then IntelliSense shows a parameter of type IList<string>. Similarly, in a Windows Runtime component written with managed code, you use the .NET type in member signatures. When the Windows Runtime Metadata Export Tool (Winmdexp.exe) generates your Windows Runtime component, the .NET type is translated into the corresponding WinRT type.
Most of the types that have the same namespace name and type name in both WinRT and .NET are structures (or types associated with structures, such as enumerations). In WinRT, structures have no members other than fields, and require helper types, which .NET hides. The .NET versions of these structures have properties and methods that provide the functionality of the hidden helper types.
Note
For a list of mappings between WinRT and .NET types in the context of desktop apps that target .NET and use C#/WinRT, see .NET mappings of WinRT types in C#/WinRT.
WinRT types that map to .NET types with the same name and namespace
In .NET assembly System.ObjectModel.dll
Namespace
Type
Windows.UI.Xaml.Input
ICommand
In .NET assembly System.Runtime.WindowsRuntime.dll
Namespace
Type
Windows.Foundation
Point
Windows.Foundation
Rect
Windows.Foundation
Size
Windows.UI
Color
In .NET assembly System.Runtime.WindowsRuntime.UI.Xaml.dll
Namespace
Type
Windows.UI.Xaml
CornerRadius
Windows.UI.Xaml
Duration
Windows.UI.Xaml
DurationType
Windows.UI.Xaml
GridLength
Windows.UI.Xaml
GridUnitType
Windows.UI.Xaml
Thickness
Windows.UI.Xaml.Controls.Primitives
GeneratorPosition
Windows.UI.Xaml.Media
Matrix
Windows.UI.Xaml.Media.Animation
KeyTime
Windows.UI.Xaml.Media.Animation
RepeatBehavior
Windows.UI.Xaml.Media.Animation
RepeatBehaviorType
Windows.UI.Xaml.Media.Media3D
Matrix3D
WinRT types that map to .NET types with a different name and/or namespace