MetadataConversionExtensions.

List<T>(IMetadata, string, IReadOnlyList<T>) Method

Summary

Gets the value for the specified key converted to a System.Collections.Generic.IReadOnlyList`1. 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.

Syntax

public static IReadOnlyList<T> List<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 containing the value.
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.
GitHub