共用方式為


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");

適用於