Windows 執行階段類型的 .NET Framework 對應
下表列出 .NET Framework 在 Windows 執行階段型別與 .NET Framework 型別之間所做的對應。在使用 Managed 程式碼撰寫的 Windows 市集應用程式中,IntelliSense 會顯示 .NET Framework 型别,而不會顯示 Windows 執行階段型别。例如,如果 Windows 執行階段方法使用型别 IVector<string> 的參數,IntelliSense 即會顯示型别 IList<string> 的參數。同樣地,在使用 Managed 程式碼撰寫的 Windows 執行階段元件中,您也會使用成員簽章中的 .NET Framework 型別。當 Windows 執行階段中繼資料匯出工具 (Winmdexp.exe) 產生您的 Windows 執行階段元件時,.NET Framework 型别會變成對應的 Windows 執行階段型别。
在 Windows 執行階段與 .NET Framework 中具有相同命名空間名稱與型别名稱的型别,大多都是結構 (或是與結構相關聯的型别,如列舉)。在 Windows 執行階段中,結構沒有欄位以外的成員,且必須要有協助程式型别 (.NET Framework 會隱藏此型别)。這些結構的 .NET Framework 版本具有相關屬性與方法,可提供隱藏的協助程式型別的功能。
如需 .NET Framework 如何使用 Windows 中繼資料簡化 Windows 執行階段之程式設計的相關資訊,請從 Windows 開發人員中心下載《CLR 與 Windows 執行階段》白皮書。
表 1:與具有不同名稱和 (或) 命名空間的 .NET Framework 型別相對應的 Windows 執行階段型别。
Windows 執行階段型別/命名空間 |
.NET Framework 型别/命名空間 |
.NET Framework 組件 |
---|---|---|
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 |
表 2:與具有相同名稱與命名空間的 .NET Framework 型別相對應的 Windows 執行階段型别。
命名空間 |
型別 |
.NET Framework 組件 |
---|---|---|
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 |