Condividi tramite


.NET Framework mappings of Windows Runtime types

 

The following table lists the mappings that the .NET Framework makes between Windows Runtime types and .NET Framework types. In a Windows 8.x Store app written with managed code, IntelliSense shows the .NET Framework type instead of the Windows Runtime type. For example, if a Windows Runtime method takes a parameter of type IVector<string>, IntelliSense shows a parameter of type IList<string>. Similarly, in a Windows Runtime component written with managed code, you use the .NET Framework type in member signatures. When the Windows Runtime Metadata Export Tool (Winmdexp.exe) generates your Windows Runtime component, the .NET Framework type becomes the corresponding Windows Runtime type.

Most of the types that have the same namespace name and type name in both the Windows Runtime and the .NET Framework are structures (or types associated with structures, such as enumerations). In the Windows Runtime, structures have no members other than fields, and require helper types, which the .NET Framework hides. The .NET Framework versions of these structures have properties and methods that provide the functionality of the hidden helper types.

For more information about the way the .NET Framework uses Windows metadata to simplify programming with the Windows Runtime, download the CLR and the Windows Runtime white paper from the Windows Dev Center.

Table 1: Windows Runtime types that map to .NET Framework types with a different name and/or namespace.

Windows Runtime type/namespace

.NET Framework type/namespace

.NET Framework assembly

AttributeUsageAttribute     (Windows.Foundation.Metadata)

AttributeUsageAttribute     (System)

System.Runtime.dll

AttributeTargets     (Windows.Foundation.Metadata)

AttributeTargets     (System)

System.Runtime.dll

DateTime     (Windows.Foundation)

DateTimeOffset     (System)

System.Runtime.dll

EventHandler<T>     (Windows.Foundation)

EventHandler<T>     (System)

System.Runtime.dll

EventRegistrationToken     (Windows.Foundation)

EventRegistrationToken     (System.Runtime.InteropServices.WindowsRuntime)

System.Runtime.InteropServices.WindowsRuntime.dll

HResult     (Windows.Foundation)

Exception     (System)

System.Runtime.dll

IReference<T>     (Windows.Foundation)

Nullable<T>     (System)

System.Runtime.dll

TimeSpan     (Windows.Foundation)

TimeSpan     (System)

System.Runtime.dll

Uri     (Windows.Foundation)

Uri     (System)

System.Runtime.dll

IClosable     (Windows.Foundation)

IDisposable     (System)

System.Runtime.dll

IIterable<T>     (Windows.Foundation.Collections)

IEnumerable<T>     (System.Collections.Generic)

System.Runtime.dll

IVector<T>     (Windows.Foundation.Collections)

IList<T>     (System.Collections.Generic)

System.Runtime.dll

IVectorView<T>     (Windows.Foundation.Collections)

IReadOnlyList<T>     (System.Collections.Generic)

System.Runtime.dll

IMap<K,V>     (Windows.Foundation.Collections)

IDictionary<TKey,TValue>     (System.Collections.Generic)

System.Runtime.dll

IMapView<K,V>     (Windows.Foundation.Collections)

IReadOnlyDictionary<TKey,TValue>     (System.Collections.Generic)

System.Runtime.dll

IKeyValuePair<K,V>     (Windows.Foundation.Collections)

KeyValuePair<TKey,TValue>     (System.Collections.Generic)

System.Runtime.dll

IBindableIterable     (Windows.UI.Xaml.Interop)

IEnumerable     (System.Collections)

System.Runtime.dll

IBindableVector     (Windows.UI.Xaml.Interop)

IList     (System.Collections)

System.Runtime.dll

INotifyCollectionChanged     (Windows.UI.Xaml.Interop)

INotifyCollectionChanged     (System.Collections.Specialized)

System.ObjectModel.dll

NotifyCollectionChangedEventHandler     (Windows.UI.Xaml.Interop)

NotifyCollectionChangedEventHandler     (System.Collections.Specialized)

System.ObjectModel.dll

NotifyCollectionChangedEventArgs     (Windows.UI.Xaml.Interop)

NotifyCollectionChangedEventArgs     (System.Collections.Specialized)

System.ObjectModel.dll

NotifyCollectionChangedAction     (Windows.UI.Xaml.Interop)

NotifyCollectionChangedAction     (System.Collections.Specialized)

System.ObjectModel.dll

INotifyPropertyChanged     (Windows.UI.Xaml.Data)

INotifyPropertyChanged     (System.ComponentModel)

System.ObjectModel.dll

PropertyChangedEventHandler     (Windows.UI.Xaml.Data)

PropertyChangedEventHandler     (System.ComponentModel)

System.ObjectModel.dll

PropertyChangedEventArgs     (Windows.UI.Xaml.Data)

PropertyChangedEventArgs     (System.ComponentModel)

System.ObjectModel.dll

TypeName     (Windows.UI.Xaml.Interop)

Type     (System)

System.Runtime.dll

    

Table 2: Windows Runtime types that map to .NET Framework types with the same name and namespace.

Namespace

Type

.NET Framework assembly

Windows.UI

Color

System.Runtime.WindowsRuntime.dll

Windows.Foundation

Point

System.Runtime.WindowsRuntime.dll

Windows.Foundation

Rect

System.Runtime.WindowsRuntime.dll

Windows.Foundation

Size

System.Runtime.WindowsRuntime.dll

Windows.UI.Xaml.Input

ICommand

System.ObjectModel.dll

Windows.UI.Xaml

CornerRadius

System.Runtime.WindowsRuntime.UI.Xaml.dll

Windows.UI.Xaml

Duration

System.Runtime.WindowsRuntime.UI.Xaml.dll

Windows.UI.Xaml

DurationType

System.Runtime.WindowsRuntime.UI.Xaml.dll

Windows.UI.Xaml

GridLength

System.Runtime.WindowsRuntime.UI.Xaml.dll

Windows.UI.Xaml

GridUnitType

System.Runtime.WindowsRuntime.UI.Xaml.dll

Windows.UI.Xaml

Thickness

System.Runtime.WindowsRuntime.UI.Xaml.dll

Windows.UI.Xaml.Controls.Primitives

GeneratorPosition

System.Runtime.WindowsRuntime.UI.Xaml.dll

Windows.UI.Xaml.Media

Matrix

System.Runtime.WindowsRuntime.UI.Xaml.dll

Windows.UI.Xaml.Media.Animation

KeyTime

System.Runtime.WindowsRuntime.UI.Xaml.dll

Windows.UI.Xaml.Media.Animation

RepeatBehavior

System.Runtime.WindowsRuntime.UI.Xaml.dll

Windows.UI.Xaml.Media.Animation

RepeatBehaviorType

System.Runtime.WindowsRuntime.UI.Xaml.dll

Windows.UI.Xaml.Media.Media3D

Matrix3D

System.Runtime.WindowsRuntime.UI.Xaml.dll

See Also

Creating Windows Runtime Components in C# and Visual Basic