MetadataConversionExtensions Class

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(IMetadata, string, 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(IMetadata, string, 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(IMetadata, string, 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(IMetadata, string, IDocument) 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(IMetadata, string, IReadOnlyList<IDocument>) IReadOnlyList<IDocument>
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(IMetadata, string, Object) 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(IMetadata, string, 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<T>(IMetadata, string, IReadOnlyList<T>) IReadOnlyList<T>
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(IMetadata, string, Func<string, string>, string) string
Formats a string value if it exists in the metadata, otherwise returns a default value.
static
String(IMetadata, string, 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
GitHub