Mappages .NET de types Windows Runtime dans les applications UWP

Cet article répertorie les mappages que .NET effectue entre les types Windows Runtime (WinRT) et les types .NET dans les applications plateforme Windows universelle (UWP) écrites avec du code managé. Dans ces applications, Visual Studio IntelliSense affiche le type .NET au lieu du type WinRT. Par exemple, si une méthode WinRT prend un paramètre de type chaîne> IVector<, IntelliSense affiche un paramètre de type chaîne> IList<. De même, dans un composant Windows Runtime écrit avec du code managé, vous utilisez le type .NET dans les signatures membres. Lorsque l’outil d’exportation de métadonnées Windows Runtime (Winmdexp.exe) génère votre composant Windows Runtime, le type .NET est traduit en type WinRT correspondant.

La plupart des types qui ont le même nom d’espace de noms et le même nom de type dans WinRT et .NET sont des structures (ou des types associés à des structures, telles que des énumérations). Dans WinRT, les structures ont pour seuls membres des champs, et elles requièrent des types d’assistance, qui sont masqués par .NET. Les versions .NET de ces structures ont des propriétés et des méthodes qui fournissent les fonctionnalités des types d’assistance masqués.

Notes

Pour obtenir la liste des mappages entre les types WinRT et .NET dans le contexte des applications de bureau qui ciblent .NET et utilisent C#/WinRT, consultez Mappages .NET des types WinRT en C#/WinRT.

Types WinRT qui mappent aux types .NET avec le même nom et le même espace de noms

Dans l’assembly .NET System.ObjectModel.dll

Espace de noms Type
Windows.UI.Xaml.Input ICommand

Dans l’assembly .NET System.Runtime.WindowsRuntime.dll

Espace de noms Type
Windows.Foundation Point
Windows.Foundation Rect
Windows.Foundation Taille
Windows.UI Color

Dans l’assembly .NET System.Runtime.WindowsRuntime.UI.Xaml.dll

Espace de noms 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 Matrice
Windows.UI.Xaml.Media.Animation KeyTime
Windows.UI.Xaml.Media.Animation RepeatBehavior
Windows.UI.Xaml.Media.Animation RepeatBehaviorType
Windows.UI.Xaml.Media.Media3D Matrix3D

Types WinRT qui mappent aux types .NET avec un nom et/ou un espace de noms différents

Dans l’assembly .NET System.ObjectModel.dll

Type/espace de noms WinRT Type/espace de noms .NET
INotifyCollectionChanged (Windows.UI.Xaml.Interop) INotifyCollectionChanged (System.Collections.Specialized)
NotifyCollectionChangedEventHandler (Windows.UI.Xaml.Interop) NotifyCollectionChangedEventHandler (System.Collections.Specialized)
NotifyCollectionChangedEventArgs (Windows.UI.Xaml.Interop) NotifyCollectionChangedEventArgs (System.Collections.Specialized)
NotifyCollectionChangedAction (Windows.UI.Xaml.Interop) NotifyCollectionChangedAction (System.Collections.Specialized)
INotifyPropertyChanged (Windows.UI.Xaml.Data) INotifyPropertyChanged (System.ComponentModel)
PropertyChangedEventHandler (Windows.UI.Xaml.Data) PropertyChangedEventHandler (System.ComponentModel)
PropertyChangedEventArgs (Windows.UI.Xaml.Data) PropertyChangedEventArgs (System.ComponentModel)

Dans l’assembly .NET System.Runtime.dll

Type/espace de noms WinRT Type/espace de noms .NET
AttributeUsageAttribute (Windows.Foundation.Metadata) AttributeUsageAttribute (System)
AttributeTargets (Windows.Foundation.Metadata) AttributeTargets (System)
DateTime (Windows.Foundation) DateTimeOffset (System)
EventHandler<T> (Windows.Foundation) EventHandler<T> (System)
HResult (Windows.Foundation) Exception (System)
IReference<T> (Windows.Foundation) Nullable<T> (System)
TimeSpan (Windows.Foundation) TimeSpan (System)
Uri (Windows.Foundation) Uri (System)
IClosable (Windows.Foundation) IDisposable (System)
IIterable<T> (Windows.Foundation.Collections) IEnumerable<T> (System.Collections.Generic)
IVector<T> (Windows.Foundation.Collections) IList<T> (System.Collections.Generic)
IVectorView<T> (Windows.Foundation.Collections) IReadOnlyList<T> (System.Collections.Generic)
IMap<K,V> (Windows.Foundation.Collections) IDictionary<TKey,TValue> (System.Collections.Generic)
IMapView<K,V> (Windows.Foundation.Collections) IReadOnlyDictionary<TKey,TValue> (System.Collections.Generic)
IKeyValuePair<K,V> (Windows.Foundation.Collections) KeyValuePair<TKey,TValue> (System.Collections.Generic)
IBindableIterable (Windows.UI.Xaml.Interop) IEnumerable (System.Collections)
IBindableVector (Windows.UI.Xaml.Interop) IList (System.Collections)
TypeName (Windows.UI.Xaml.Interop) Type (System)

Dans les System.Runtime.InteropServices.WindowsRuntime.dll d’assembly .NET

Type/espace de noms WinRT Type/espace de noms .NET
EventRegistrationToken (Windows.Foundation) EventRegistrationToken (System.Runtime.InteropServices.WindowsRuntime)