Gets the value for the specified key converted to a nested
IMetadata
. This method never throws an exception.
It will return null if the key is not found.
- Namespace
- Statiq
.Common - Containing Type
- I
Metadata Conversion Extensions
Syntax
public static IMetadata GetMetadata(this IMetadata metadata, string key, IMetadata defaultValue = null)
Parameters
Name | Type | Description |
---|---|---|
metadata | IMetadata | The metadata instance. |
key | string | The key of the nested metadata to get. |
defaultValue | IMetadata | The default value to use if the key is not found or cannot be converted to nested metadata. |
Return Value
Type | Description |
---|---|
IMetadata | The value for the specified key converted to a nested metadata instance or null. |