Summary
Extensions to make it easier to get typed information from metadata.
- Assembly
- Wyam
.Common .dll - Namespace
- Wyam
.Common .Meta - Base Types
-
- Object
graph BT
Type-->Base0["Object"]
Type["MetadataConversionExtensions"]
class Type type-node
Syntax
public static class MetadataConversionExtensions
Methods
Name | Value | Summary |
---|---|---|
Bool |
bool |
Gets the value for the specified key converted to a bool. This method never throws an exception. It will return the specified
default value if the key is not found.
static
|
DateTime |
DateTime |
Gets the value for the specified key converted to a
Wyam.Common.Meta.MetadataConversionExtensions.DateTime(Wyam.Common.Meta.IMetadata,System.String,System.DateTime) . This method never throws an exception. It will return the specified
default value if the key is not found.
static
|
DirectoryPath |
DirectoryPath |
Gets the value for the specified key converted to a
Wyam.Common.Meta.MetadataConversionExtensions.DirectoryPath(Wyam.Common.Meta.IMetadata,System.String,Wyam.Common.IO.DirectoryPath) . This method never throws an exception. It will
return the specified default value if the key is not found or if the string value can't be converted to a Wyam.Common.Meta.MetadataConversionExtensions.DirectoryPath(Wyam.Common.Meta.IMetadata,System.String,Wyam.Common.IO.DirectoryPath) .
static
|
Document |
IDocument |
Gets the value for the specified key converted to a
Wyam.Common.Documents.IDocument . This method never throws an exception.
It will return null if the key is not found.
static
|
DocumentList |
IReadOnlyList |
Gets the value for the specified key converted to a
IReadOnlyList<IDocument> . 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 Wyam.Common.Documents.IDocument .
static
|
Dynamic |
dynamic |
Gets the value associated with the specified key as a dynamic object. This is equivalent
to calling
as dynamic to cast the value.
static
|
FilePath |
FilePath |
Gets the value for the specified key converted to a
Wyam.Common.Meta.MetadataConversionExtensions.FilePath(Wyam.Common.Meta.IMetadata,System.String,Wyam.Common.IO.FilePath) . This method never throws an exception. It will
return the specified default value if the key is not found or if the string value can't be converted to a Wyam.Common.Meta.MetadataConversionExtensions.FilePath(Wyam.Common.Meta.IMetadata,System.String,Wyam.Common.IO.FilePath) .
static
|
List |
IReadOnlyList |
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.
static
|
String |
string |
Formats a string value if it exists in the metadata, otherwise returns a default value.
static
|
String |
string |
Gets the value for the specified key converted to a string. This method never throws an exception. It will return the specified
default value if the key is not found.
static
|