TryGetValue<TValue>(IMetadata, string, TValue) Method
Tries to get the value for the specified key.
Namespace
Statiq.Common
Containing Type
IMetadataGetExtensions

Syntax

public static bool TryGetValue<TValue>(this IMetadata metadata, string key, out TValue value)

Remarks

This method will also materialize IMetadataValue and evaluate script strings (a key that starts with "=>" will be treated as a script and evaluated).

Type Parameters

Name Description
TValue The desired return type.

Parameters

Name Type Description
metadata IMetadata The metadata instance.
key string The key of the value to get. If the key is null, this will return the default value.
value TValue The value of the key if it was found and could be converted to the desired return type.

Return Value

Type Description
bool true if the key was found and the value could be converted to the desired return type, false otherwise.