ValueSet ValueSet ValueSet ValueSet Class

Definition

Implements a map with keys of type String and values of type Object. This class prevents non-serializable types from being put into the map.

Note

Some members are only available for the specified language.

public : sealed class ValueSet : IIterable<IKeyValuePair<Platform::String, Platform::Object>>, IMap<Platform::String, Platform::Object>, IObservableMap<Platform::String, Platform::Object>, IPropertySet
public sealed class ValueSet : IEnumerable<KeyValuePair<String, Object>>, IDictionary<String, Object>, IObservableMap<String, Object>, IPropertySet
Public NotInheritable Class ValueSet Implements IEnumerable<KeyValuePair<String, Object>>, IDictionary<String, Object>, IObservableMap<String, Object>, IPropertySet
var valueSet = new valueSet();
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.FoundationContract (introduced v1)

Constructors

ValueSet() ValueSet() ValueSet() ValueSet()

Creates and initializes a new instance of the property set.

public : ValueSet()
public ValueSet()
Public Sub New()
var valueSet = new valueSet();

Properties

Item[TKey] Item[TKey] Item[TKey] Item[TKey]

Gets or sets the element with the specified key.

This member is not implemented in C++
TValue this[TKey key] { get; set; }
Property Item(key As TKey) As TValue
TValue this[TKey key] { get; set; }
Parameters
key
TKey TKey TKey TKey

The key of the element to get or set.

Value
TValue TValue TValue TValue

The element with the specified key.

Exceptions

key is null.

The property is retrieved and key is not found.

The property is set and the System.Collections.Generic.IDictionary`2 is read-only.

Keys Keys Keys Keys

Gets an System.Collections.Generic.ICollection`1 containing the keys of the System.Collections.Generic.IDictionary`2.

This member is not implemented in C++
ICollection<TKey> Keys { get; }
ReadOnly Property Keys As ICollection(Of TKey)
ICollection<TKey> Keys { get; }
Value

An System.Collections.Generic.ICollection`1 containing the keys of the object that implements System.Collections.Generic.IDictionary`2.

Size Size Size Size

Gets the number of items contained in the value set.

public : unsigned int Size { get; }
This member is not implemented in C#
This member is not implemented in VB.Net
var uint = valueSet.size;
Value
unsigned int uint uint uint

The number of items in the value set.

Remarks

Some functionality in this class is restricted to specific development languages. The parent topic, ValueSet class, indicates which members are accessible in specific languages. For functionality similar to this member, see Count.

See Also

Values Values Values Values

Gets an System.Collections.Generic.ICollection`1 containing the values in the System.Collections.Generic.IDictionary`2.

This member is not implemented in C++
ICollection<TValue> Values { get; }
ReadOnly Property Values As ICollection(Of TValue)
ICollection<TValue> Values { get; }
Value

An System.Collections.Generic.ICollection`1 containing the values in the object that implements System.Collections.Generic.IDictionary`2.

Methods

Add(TKey, TValue) Add(TKey, TValue) Add(TKey, TValue) Add(TKey, TValue)

Adds an element with the provided key and value to the System.Collections.Generic.IDictionary`2.

This member is not implemented in C++
void Add(TKey key, TValue value)
Sub Add(key As TKey, value As TValue)
void Add(TKey key, TValue value)
Parameters
key
TKey TKey TKey TKey

The object to use as the key of the element to add.

value
TValue TValue TValue TValue

The object to use as the value of the element to add.

Exceptions

key is null.

An element with the same key already exists in the System.Collections.Generic.IDictionary`2.

The System.Collections.Generic.IDictionary`2 is read-only.

Clear() Clear() Clear() Clear()

Removes all items from the value set.

public : void Clear()
This member is not implemented in C#
This member is not implemented in VB.Net
valueSet.clear();

ContainsKey(TKey) ContainsKey(TKey) ContainsKey(TKey) ContainsKey(TKey)

Determines whether the System.Collections.Generic.IDictionary`2 contains an element with the specified key.

This member is not implemented in C++
bool ContainsKey(TKey key)
Function ContainsKey(key As TKey) As Boolean
bool ContainsKey(TKey key)
Parameters
key
TKey TKey TKey TKey

The key to locate in the System.Collections.Generic.IDictionary`2.

Returns

true if the System.Collections.Generic.IDictionary`2 contains an element with the key; otherwise, false.

Exceptions

key is null.

First() First() First() First()

Returns an iterator to enumerate the items in the value set.

public : IIterator<IKeyValuePair<Platform::String, Platform::Object>> First()
This member is not implemented in C#
This member is not implemented in VB.Net
var iIterator = valueSet.first();
Returns
IIterator<IKeyValuePair<Platform::String, Platform::Object>> IIterator<KeyValuePair<string, object>> IIterator<KeyValuePair<string, object>> IIterator<KeyValuePair<string, object>>

The iterator. The current position of the iterator is index 0, or the end of the value set if the value set is empty.

GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

Returns an enumerator that iterates through the collection.

This member is not implemented in C++
IEnumerator<T> GetEnumerator()
Function GetEnumerator As IEnumerator(Of T)
IEnumerator<T> GetEnumerator()
Returns

An enumerator that can be used to iterate through the collection.

GetView() GetView() GetView() GetView()

Gets an immutable view of the value set.

public : IMapView<Platform::String, Platform::Object> GetView()
This member is not implemented in C#
This member is not implemented in VB.Net
var iMapView = valueSet.getView();
Returns
IMapView<Platform::String, Platform::Object> IReadOnlyDictionary<string, object> IReadOnlyDictionary<string, object> IReadOnlyDictionary<string, object>

The immutable view.

HasKey(String) HasKey(String) HasKey(String) HasKey(String)

Indicates whether the value set has an item with the specified key.

public : Platform::Boolean HasKey(Platform::String key)
This member is not implemented in C#
This member is not implemented in VB.Net
var bool = valueSet.hasKey(key);
Parameters
key
Platform::String String String String

The key.

Returns
Platform::Boolean bool bool bool

True if the value set has an item with the specified key; otherwise, false.

Remarks

Some functionality in this class is restricted to specific development languages. The parent topic, ValueSet class, indicates which members are accessible in specific languages. For functionality similar to this member, see ContainsKey.

See Also

Insert(String, Object) Insert(String, Object) Insert(String, Object) Insert(String, Object)

Adds an item to the value set.

public : Platform::Boolean Insert(Platform::String key, Platform::Object value)
This member is not implemented in C#
This member is not implemented in VB.Net
var bool = valueSet.insert(key, value);
Parameters
key
Platform::String String String String

The key to insert.

value
Platform::Object Object Object Object

The value to insert.

Returns
Platform::Boolean bool bool bool

True if the method replaces a value that already exists for the key; false if this is a new key.

Remarks

Some functionality in this class is restricted to specific development languages. The parent topic, ValueSet class, indicates which members are accessible in specific languages. For functionality similar to this member, see Add(String,Object) and Add(KeyValuePair).

See Also

Lookup(String) Lookup(String) Lookup(String) Lookup(String)

Retrieves the value for the specified key.

public : Platform::Object Lookup(Platform::String key)
This member is not implemented in C#
This member is not implemented in VB.Net
var object = valueSet.lookup(key);
Parameters
key
Platform::String String String String

The key.

Returns
Platform::Object object object object

The value, if an item with the specified key exists. Use the HasKey method to determine whether the key exists.

Remarks

Some functionality in this class is restricted to specific development languages. The parent topic, ValueSet class, indicates which members are accessible in specific languages. For functionality similar to this member, see TryGetValue.

See Also

Remove(TKey) Remove(TKey) Remove(TKey) Remove(TKey)

Removes the element with the specified key from the System.Collections.Generic.IDictionary`2.

This member is not implemented in C++
bool Remove(TKey key)
Function Remove(key As TKey) As Boolean
bool Remove(TKey key)
Parameters
key
TKey TKey TKey TKey

The key of the element to remove.

Returns

true if the element is successfully removed; otherwise, false. This method also returns false if key was not found in the original System.Collections.Generic.IDictionary`2.

Exceptions

key is null.

The System.Collections.Generic.IDictionary`2 is read-only.

Remove(String) Remove(String) Remove(String) Remove(String)

Removes an item from the value set.

public : void Remove(Platform::String key)
This member is not implemented in C#
This member is not implemented in VB.Net
valueSet.remove(key);
Parameters
key
Platform::String String String String

The key.

Remarks

Some functionality in this class is restricted to specific development languages. The parent topic, ValueSet class, indicates which members are accessible in specific languages. For functionality similar to this member, see Remove(String) and Remove(KeyValuePair).

See Also

TryGetValue(TKey, out TValue) TryGetValue(TKey, out TValue) TryGetValue(TKey, out TValue) TryGetValue(TKey, out TValue)

Gets the value associated with the specified key.

This member is not implemented in C++
bool TryGetValue(TKey key, out TValue value)
Function TryGetValue(key As TKey, ByRef value As TValue) As Boolean
bool TryGetValue(TKey key, out TValue value)
Parameters
key
TKey TKey TKey TKey

The key whose value to get.

value
TValue TValue TValue TValue

When this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized.

Returns

true if the object that implements System.Collections.Generic.IDictionary`2 contains an element with the specified key; otherwise, false.

Exceptions

key is null.

Events

MapChanged MapChanged MapChanged MapChanged

Occurs when the observable map has changed.

public : event MapChangedEventHandler MapChanged<Platform::String,  object>
public event MapChangedEventHandler MapChanged<string,  object>
Public Event MapChangedEventHandler MapChanged( Of ( Of string ), ( Of  object ))
function onMapChanged(eventArgs){/* Your code */}


valueSet.addEventListener("mapChanged", onMapChanged);
valueSet.removeEventListener("mapChanged", onMapChanged);