Partager via


IXRItemCollection::IndexOf (Compact 2013)

3/28/2014

This method searches for the specified item and retrieves the zero-based index of its last occurrence within this collection.

Syntax

virtual HRESULT STDMETHODCALLTYPE IndexOf(
    __in XRValue* pValue,
    __out_opt int* pIndex
) = 0;

Parameters

  • pValue
    [in] Pointer to an XRValue object that represents an item to locate in this collection.
  • pIndex
    [out] Pointer to an integer value that indicates the zero-based index of the last occurrence of pValue within this collection.

Return Value

Returns S_OK if successful; otherwise, returns an HRESULT error code. For common error codes for XAML for Windows Embedded, see XAML for Windows Embedded Error Messages.

Remarks

This method performs a linear search through the collection. Therefore, the average execution time is proportional to the number of items. You can retrieve the number of items by using IXRItemCollection::GetCount.

By default, this method searches the collection starting at the last item and ending at the first item.

To use a specific interface pointer type, use the helper template version of this method XAML for Windows Embedded provides. When you supply a derived type, this version automatically supplies a type-safe method that implicitly converts the returned type from a generic interface so you do not have to explicitly call QueryInterface to convert the generic interface into the required object type.

.NET Framework Equivalent

System.Windows.PresentationFrameworkCollection(T).IList.IndexOf

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

IXRItemCollection
IXRItemsControl::GetItems