DbRawSqlQuery<TElement>.ToDictionaryAsync<TKey> メソッド (Func<TElement, TKey>, IEqualityComparer<TKey>, CancellationToken)
[このページは、Entity Framework 6 に関するページです。最新バージョンは、'Entity Framework' NuGet パッケージとして入手できます。Entity Framework の詳細については、msdn.com/data/ef を参照してください。]
指定されたキー セレクター関数および比較子に従って、非同期に列挙してクエリから Dictionary<TKey, TValue> を作成します。
名前空間: System.Data.Entity.Infrastructure
アセンブリ: EntityFramework (EntityFramework.dll 内)
構文
'宣言
<SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")> _
Public Function ToDictionaryAsync(Of TKey) ( _
keySelector As Func(Of TElement, TKey), _
comparer As IEqualityComparer(Of TKey), _
cancellationToken As CancellationToken _
) As Task(Of Dictionary(Of TKey, TElement))
'使用
Dim instance As DbRawSqlQuery
Dim keySelector As Func(Of TElement, TKey)
Dim comparer As IEqualityComparer(Of TKey)
Dim cancellationToken As CancellationToken
Dim returnValue As Task(Of Dictionary(Of TKey, TElement))
returnValue = instance.ToDictionaryAsync(keySelector, _
comparer, cancellationToken)
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public Task<Dictionary<TKey, TElement>> ToDictionaryAsync<TKey>(
Func<TElement, TKey> keySelector,
IEqualityComparer<TKey> comparer,
CancellationToken cancellationToken
)
[SuppressMessageAttribute(L"Microsoft.Design", L"CA1006:DoNotNestGenericTypesInMemberSignatures")]
public:
generic<typename TKey>
Task<Dictionary<TKey, TElement>^>^ ToDictionaryAsync(
Func<TElement, TKey>^ keySelector,
IEqualityComparer<TKey>^ comparer,
CancellationToken cancellationToken
)
[<SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")>]
member ToDictionaryAsync :
keySelector:Func<'TElement, 'TKey> *
comparer:IEqualityComparer<'TKey> *
cancellationToken:CancellationToken -> Task<Dictionary<'TKey, 'TElement>>
JScript does not support generic types and methods.
型パラメーター
- TKey
keySelector によって返されるキーの型。
パラメーター
- keySelector
型 : System.Func<TElement, TKey>
各要素からキーを抽出する関数。
- comparer
型 : System.Collections.Generic.IEqualityComparer<TKey>
キーを比較する IEqualityComparer<T>。
- cancellationToken
型 : System.Threading.CancellationToken
タスクの完了を待機しているときに観察する CancellationToken。
戻り値
型 : System.Threading.Tasks.Task<Dictionary<TKey, TElement>>
非同期操作を表すタスク。タスクの結果には、選択したキーと値を格納する Dictionary<TKey, TValue> が示されます。
解説
同じコンテキスト インスタンスに対する複数のアクティブ操作はサポートされません。 このコンテキストで別のメソッドを呼び出す前に、非同期操作が完了したことを確認するために await を使用します。