GroupBy<TKey, TElement>(IEnumerable<IDocument>, string, string, IEqualityComparer<TKey>) Method
Groups the elements of a sequence of documents and the values of a specified metadata key using the value of the specified element metadata for the elements of the group and compares the keys by using a specified comparer. If a document does not contain the specified key or element metadata keys, it is not included in the result set.
Namespace
Statiq.Common
Containing Type
IDocumentGroupByExtensions

Syntax

public static IEnumerable<IGrouping<TKey, TElement>> GroupBy<TKey, TElement>(this IEnumerable<IDocument> documents, string keyMetadataKey, string elementMetadataKey, IEqualityComparer<TKey> comparer)

Type Parameters

Name Description
TKey The type of the key.
TElement The type of the element.

Parameters

Name Type Description
documents IEnumerable<IDocument> The documents.
keyMetadataKey string The key metadata key.
elementMetadataKey string The element metadata key.
comparer IEqualityComparer<TKey> The comparer.

Return Value

Type Description
IEnumerable<IGrouping<TKey, TElement>> A sequence of groups.