StorageItemQueryResult.FindStartIndexAsync(Object) Metode
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mengambil indeks item dari hasil kueri yang paling cocok dengan nilai properti yang ditentukan. Properti yang cocok ditentukan oleh SortEntry pertama dari daftar QueryOptions.SortOrder .
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)
Parameter
- value
-
Object
Platform::Object
IInspectable
Nilai properti yang cocok saat mencari hasil kueri. Properti yang digunakan untuk mencocokkan nilai ini adalah properti di SortEntry pertama dari daftar QueryOptions.SortOrder .
Mengembalikan
Ketika metode ini berhasil diselesaikan, metode ini mengembalikan indeks item yang cocok dalam hasil kueri.
Penerapan
- Atribut
Contoh
Contoh ini memperlihatkan cara menemukan item pertama yang memiliki judul album yang dimulai dengan "R" dalam serangkaian hasil kueri yang berisi album yang diurutkan menurut judul.
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");