Compartilhar via


Mapeamentos do .NET de tipos de Windows Runtime em aplicativos UWP

Este artigo lista os mapeamentos que o .NET faz entre tipos de Windows Runtime (WinRT) e tipos .NET em aplicativos Plataforma Universal do Windows (UWP) escritos com código gerenciado. Nesses aplicativos, o Visual Studio IntelliSense mostra o tipo .NET em vez do tipo WinRT. Por exemplo, se um método WinRT usa um parâmetro do tipo cadeia de caracteres IVector<>, o IntelliSense mostra um parâmetro do tipo cadeia de caracteres IList<>. Da mesma forma, em um componente Windows Runtime escrito com código gerenciado, você usa o tipo .NET em assinaturas de membro. Quando a ferramenta de exportação de metadados Windows Runtime (Winmdexp.exe) gera seu componente Windows Runtime, o tipo .NET é convertido no tipo WinRT correspondente.

A maioria dos tipos que têm o mesmo nome de namespace e nome de tipo no WinRT e no .NET são estruturas (ou tipos associados a estruturas, como enumerações). No WinRT, as estruturas não têm membros além de campos e exigem tipos de auxiliar, que são ocultados pelo .NET. As versões do .NET dessas estruturas têm propriedades e métodos que fornecem a funcionalidade dos tipos auxiliares ocultos.

Observação

Para obter uma lista de mapeamentos entre tipos WinRT e .NET no contexto de aplicativos da área de trabalho direcionados ao .NET e que usam C#/WinRT, consulte Mapeamentos do .NET de tipos WinRT no C#/WinRT.

Tipos do WinRT que são mapeados para tipos .NET com o mesmo nome e namespace

No System.ObjectModel.dll de assembly do .NET

Namespace Type
Windows.UI.Xaml.Input ICommand

No System.Runtime.WindowsRuntime.dll de assembly do .NET

Namespace Type
Windows.Foundation Point
Windows.Foundation Rect
Windows.Foundation Tamanho
Windows.UI Cor

No System.Runtime.WindowsRuntime.UI.Xaml.dll de assembly do .NET

Namespace Type
Windows.UI.Xaml CornerRadius
Windows.UI.Xaml Duração
Windows.UI.Xaml DurationType
Windows.UI.Xaml GridLength
Windows.UI.Xaml GridUnitType
Windows.UI.Xaml Espessura
Windows.UI.Xaml.Controls.Primitives GeneratorPosition
Windows.UI.Xaml.Media Matriz
Windows.UI.Xaml.Media.Animation KeyTime
Windows.UI.Xaml.Media.Animation RepeatBehavior
Windows.UI.Xaml.Media.Animation RepeatBehaviorType
Windows.UI.Xaml.Media.Media3D Matrix3D

Tipos winRT que são mapeados para tipos .NET com um nome e/ou namespace diferentes

No System.ObjectModel.dll de assembly do .NET

Tipo/namespace do WinRT Tipo/namespace do .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)

No System.Runtime.dll de assembly do .NET

Tipo/namespace do WinRT Tipo/namespace do .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)

No System.Runtime.InteropServices.WindowsRuntime.dll de assembly do .NET

Tipo/namespace do WinRT Tipo/namespace do .NET
EventRegistrationToken (Windows.Foundation) EventRegistrationToken (System.Runtime.InteropServices.WindowsRuntime)