StorageFolderQueryResult.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>

此方法成功完成后,它会在查询结果中返回匹配文件夹的索引;否则返回 uint。MaxValue

实现

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.CreateFolderQueryWithOptions(queryOptions);
var firstIndex = await queryResult.FindStartIndexAsync("R");

适用于