GetList<T>(IMetadata, string, IReadOnlyList<T>) Method
Gets the value for the specified key converted to a IReadOnlyList<T>. This method never throws an exception. It will return the specified default value if the key is not found. Note that if the value is atomic, the conversion operation will succeed and return a list with one item.
Namespace
Statiq.Common
Containing Type
IMetadataConversionExtensions

Syntax

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

Type Parameters

Name Description
T The type to convert to.

Parameters

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

Return Value

Type Description
IReadOnlyList<T> The value for the specified key converted to a list or the specified default value.