ValueSet 类

定义

使用 字符串 类型的键和 Object 类型的值实现映射。 对象必须是 WinRT PropertyValue 或 ValueSet。 作为 PropertyValue,它可以是 除 PropertyTypeInspectableArray 之外的任何类型。 存在此限制是为了确保值可以序列化;通过值跨进程边界传递。

注意

某些成员仅适用于指定的语言。

public ref class ValueSet sealed : IIterable<IKeyValuePair<Platform::String ^, Platform::Object ^> ^>, IMap<Platform::String ^, Platform::Object ^>, IObservableMap<Platform::String ^, Platform::Object ^>, IPropertySet
/// [Windows.Foundation.Metadata.Activatable(65536, Windows.Foundation.FoundationContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.FoundationContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class ValueSet final : IIterable<IKeyValuePair<winrt::hstring, IInspectable const&>>, IMap<winrt::hstring, IInspectable const&>, IObservableMap<winrt::hstring, IInspectable const&>, IPropertySet
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.FoundationContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.FoundationContract")]
class ValueSet final : IIterable<IKeyValuePair<winrt::hstring, IInspectable const&>>, IMap<winrt::hstring, IInspectable const&>, IObservableMap<winrt::hstring, IInspectable const&>, IPropertySet
[Windows.Foundation.Metadata.Activatable(65536, typeof(Windows.Foundation.FoundationContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.FoundationContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class ValueSet : IDictionary<string,object>, IEnumerable<KeyValuePair<string,object>>, IObservableMap<string,object>, IPropertySet
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.FoundationContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.FoundationContract")]
public sealed class ValueSet : IDictionary<string,object>, IEnumerable<KeyValuePair<string,object>>, IObservableMap<string,object>, IPropertySet
function ValueSet()
Public NotInheritable Class ValueSet
Implements IDictionary(Of String, Object), IEnumerable(Of KeyValuePair(Of String, Object)), IObservableMap(Of String, Object), IPropertySet
继承
Object Platform::Object IInspectable ValueSet
属性
实现
IMap<K,V> IDictionary<K,V> IMap<String,Object> IDictionary<String,Object> IMap<Platform::String,Platform::Object> IMap<winrt::hstring,IInspectable> IIterable<IKeyValuePair<K,V>> IEnumerable<KeyValuePair<K,V>> IIterable<IKeyValuePair<String,Object>> IEnumerable<KeyValuePair<String,Object>> IIterable<IKeyValuePair<Platform::String,Platform::Object>> IIterable<IKeyValuePair<winrt::hstring,IInspectable>> IObservableMap<String,Object> IObservableMap<Platform::String,Platform::Object> IObservableMap<winrt::hstring,IInspectable> IPropertySet

Windows 要求

设备系列
Windows 10 (在 10.0.10240.0 中引入)
API contract
Windows.Foundation.FoundationContract (在 v1.0 中引入)

构造函数

ValueSet()

创建并初始化属性集的新实例。

属性

Size

获取值集中包含的项数。

方法

Clear()

从值集中删除所有项。

First()

返回一个迭代器,用于枚举值集中的项。

GetView()

获取值集的不可变视图。

HasKey(String)

指示值集是否具有具有指定键的项。

Insert(String, Object)

将项添加到值集。

Lookup(String)

检索指定键的值。

Remove(String)

从值集中删除项。

事件

MapChanged

当可观测映射发生更改时发生。

适用于

另请参阅