diff --git a/src/XperienceCommunity.QueryExtensions/Documents/XperienceCommunityDocumentMaterializationExtensions.cs b/src/XperienceCommunity.QueryExtensions/Documents/XperienceCommunityDocumentMaterializationExtensions.cs index d163147..065aa5f 100644 --- a/src/XperienceCommunity.QueryExtensions/Documents/XperienceCommunityDocumentMaterializationExtensions.cs +++ b/src/XperienceCommunity.QueryExtensions/Documents/XperienceCommunityDocumentMaterializationExtensions.cs @@ -54,6 +54,23 @@ public static async Task> ToListAsync(this MultiDocumentQuery qu return result.ToList(); } + /// + /// Converts the to a of + /// + /// The current MultiDocumentQuery + /// Mapping function from to + /// Optional cancellation token + /// + public static async Task> ToListAsync( + this MultiDocumentQuery query, + Func projection, + CancellationToken token = default) + { + var result = await query.GetEnumerableTypedResultAsync(cancellationToken: token); + + return result.Select(projection).ToList(); + } + /// /// Returns the first item of the as the generic Page type and null if no items were returned. ///