Gets the value for the specified key converted to a IReadOnlyList<TDocument>
. 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 the specified document type.
Syntax
public static IEnumerable<TDocument> GetDocuments<TDocument>(this IMetadata metadata, string key, IReadOnlyList<TDocument> defaultValue = null)
where TDocument : IDocument
Type Parameters
Name |
Description |
TDocument |
|
Parameters
Name |
Type |
Description |
metadata |
IMetadata |
The metadata instance. |
key |
string |
The key of the documents to get. |
defaultValue |
IReadOnlyList<TDocument> |
The default value to use if the key is not found or cannot be converted to a document list. |
Return Value
Type |
Description |
IEnumerable<TDocument> |
The value for the specified key converted to a list or null. |