MetadataConversionExtensions.

DocumentList(IMetadata, string, IReadOnlyList<IDocument>) Method

Summary

Gets the value for the specified key converted to a IReadOnlyList<IDocument>. This method never throws an exception. It will return null if the key is not found and an empty list if the key is found but contains no items that can be converted to Wyam.Common.Documents.IDocument.

Syntax

public static IReadOnlyList<IDocument> DocumentList(this IMetadata metadata, string key, IReadOnlyList<IDocument> defaultValue = null)

Parameters

Name Type Description
metadata IMetadata The metadata containing the value.
key string The key of the documents to get.
defaultValue IReadOnlyList<IDocument> The default value to use if the key is not found or cannot be converted to a document list.

Return Value

Type Description
IReadOnlyList<IDocument> The value for the specified key converted to a list or null.
GitHub