Get<T>(IMetadata, string, T) Method
Gets the value for the specified key. This method never throws an exception. It will return the specified default value if the key is not found or is null.
Namespace
Statiq.Common
Containing Type
IMetadataGetExtensions

Syntax

public static T Get<T>(this IMetadata metadata, string key, T defaultValue)

Type Parameters

Name Description
T The desired return type.

Parameters

Name Type Description
metadata IMetadata The metadata instance.
key string The key of the value to get.
defaultValue T The default value to use if the key is not found, is null, or cannot be converted to type T.

Return Value

Type Description
T The value for the specified key converted to type T or the specified default value.