Dela via


StringMap Class

Definition

An associative collection, also known as a map or a dictionary.

public ref class StringMap sealed : IIterable<IKeyValuePair<Platform::String ^, Platform::String ^> ^>, IMap<Platform::String ^, Platform::String ^>, IObservableMap<Platform::String ^, Platform::String ^>
/// [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 StringMap final : IIterable<IKeyValuePair<winrt::hstring, winrt::hstring const&>>, IMap<winrt::hstring, winrt::hstring const&>, IObservableMap<winrt::hstring, winrt::hstring const&>
/// [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 StringMap final : IIterable<IKeyValuePair<winrt::hstring, winrt::hstring const&>>, IMap<winrt::hstring, winrt::hstring const&>, IObservableMap<winrt::hstring, winrt::hstring const&>
[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 StringMap : IDictionary<string,string>, IEnumerable<KeyValuePair<string,string>>, IObservableMap<string,string>
[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 StringMap : IDictionary<string,string>, IEnumerable<KeyValuePair<string,string>>, IObservableMap<string,string>
function StringMap()
Public NotInheritable Class StringMap
Implements IDictionary(Of String, String), IEnumerable(Of KeyValuePair(Of String, String)), IObservableMap(Of String, String)
Inheritance
Object Platform::Object IInspectable StringMap
Attributes
Implements
IMap<K,V> IDictionary<K,V> IMap<String,String> IDictionary<String,String> IMap<Platform::String,Platform::String> IMap<winrt::hstring,winrt::hstring> IIterable<IKeyValuePair<K,V>> IEnumerable<KeyValuePair<K,V>> IIterable<IKeyValuePair<String,String>> IEnumerable<KeyValuePair<String,String>> IIterable<IKeyValuePair<Platform::String,Platform::String>> IIterable<IKeyValuePair<winrt::hstring,winrt::hstring>> IObservableMap<String,String> IObservableMap<Platform::String,Platform::String> IObservableMap<winrt::hstring,winrt::hstring>

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.FoundationContract (introduced in v1.0)

Remarks

This class allows JavaScript to easily iterate over a collection for which strings are the only expected value for both keys and values.

Constructors

StringMap()

Creates and initializes a new instance of the StringMap.

Properties

Size

Gets the number of items in the map.

Methods

Clear()

Removes all items from the map.

First()

Returns an iterator containing the items in the collection.

GetView()

Returns an immutable view of the map.

HasKey(String)

Determines whether the map contains the specified key.

Insert(String, String)

Inserts or replaces an item in the map.

Lookup(String)

Returns the item at the specified key in the map.

Remove(String)

Removes an item from the map.

Events

MapChanged

Occurs when the contents of the map change.

Applies to

See also