Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

IMap::GetView method

Returns an immutable view of the IMap.

Syntax


HRESULT GetView(
  [out]  IMapView **view
);

Parameters

view [out]

Type: IMapView**

The view of the map.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Examples

The following code example demonstrates how to use the GetView method.


comptr<IMap<HSTRING,IValue>> pMap;
HSTRING hKey;
//...

comptr<IMapView<HSTRING,IValue>> pMapView;
HRESULT hr = pMap->GetView(&pMapView);
if (SUCCEEDED(hr))
{
    bool bHasKey
    hr = pMapView->HasKey(hKey, &bHasKey);
    if (SUCCEEDED(hr) && bHasKey)
    {
        comptr<IValue> pValue;
        hr = pMapView->Lookup(hKey, &pValue);
        if (SUCCEEDED(hr))
        {
            //...
        }
    }
}


Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Header

Windows.Foundation.Collections.h

See also

IMap
IMapView

 

 

Community Additions

Show:
© 2014 Microsoft