StorageItemQueryResult.FindStartIndexAsync(Object) 方法

定义

从与指定属性值最匹配的查询结果中检索项的索引。 匹配的属性由 QueryOptions.SortOrder 列表的第一个 SortEntry 确定。

public:
 virtual IAsyncOperation<unsigned int> ^ FindStartIndexAsync(Platform::Object ^ value) = FindStartIndexAsync;
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperation<uint32_t> FindStartIndexAsync(IInspectable const& value);
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperation<uint> FindStartIndexAsync(object value);
function findStartIndexAsync(value)
Public Function FindStartIndexAsync (value As Object) As IAsyncOperation(Of UInteger)

参数

value
Object

Platform::Object

IInspectable

搜索查询结果时要匹配的属性值。 用于匹配此值的 属性是 QueryOptions.SortOrder 列表的第一个 SortEntry 中的 属性。

返回

IAsyncOperation<UInt32>

Windows.Foundation.IAsyncOperation

IAsyncOperation<uint32_t>

此方法成功完成后,它将返回查询结果中匹配项的索引。

实现

M:Windows.Storage.Search.IStorageQueryResultBase.FindStartIndexAsync(System.Object) M:Windows.Storage.Search.IStorageQueryResultBase.FindStartIndexAsync(Platform::Object) M:Windows.Storage.Search.IStorageQueryResultBase.FindStartIndexAsync(IInspectable)
属性

示例

此示例演示如何在包含按标题排序的相册的一组查询结果中查找具有以“R”开头的专辑标题的第一项。

QueryOptions queryOptions = new QueryOptions();
queryOptions.FolderDepth = FolderDepth.Deep;
queryOptions.IndexerOption = IndexerOption.OnlyUseIndexer;
SortEntry album = new SortEntry();
album.AscendingOrder = true;
album.PropertyName = "System.Music.AlbumTitle";
queryOptions.SortOrder.Add(album);

StorageFolderQueryResult queryResult = musicFolder.CreateItemQueryWithOptions(queryOptions);
var firstIndex = await queryResult.FindStartIndexAsync("R");

适用于