Summary
A dictionary with metadata type conversion superpowers.
- Assembly
- Wyam
.Common .dll - Namespace
- Wyam
.Common .Meta - Interfaces
-
- IMetadataDictionary
- IDictionary
<string, Object> - IMetadata
- IReadOnlyDictionary
<string, Object>
- Base Types
-
- Object
graph BT
Type-->Base0["Object"]
Type-.->Interface0["IMetadataDictionary"]
click Interface0 "/api/Wyam.Common.Meta/IMetadataDictionary"
Type-.->Interface1["IDictionary<string, Object>"]
Type-.->Interface2["IMetadata"]
click Interface2 "/api/Wyam.Common.Meta/IMetadata"
Type-.->Interface3["IReadOnlyDictionary<string, Object>"]
Type["ConvertingDictionary"]
class Type type-node
Syntax
public class ConvertingDictionary : IMetadataDictionary, IDictionary<string, Object>, IMetadata,
IReadOnlyDictionary<string, Object>
Remarks
This class wraps an underlying
System.Collections.Generic.Dictionary`2
but
uses the provided Wyam.Common.Execution.IExecutionContext
to perform type conversions
when requesting values.
Constructors
Properties
Name | Value | Summary |
---|---|---|
Count | int |
The count of metadata.
|
IsReadOnly | bool | |
Keys | ICollection |
A collection of keys in the metadata.
|
this[string] | Object |
Gets a metadata value given the specified metadata key.
|
Values | ICollection |
A collection of values in the metadata.
|
Methods
Name | Value | Summary |
---|---|---|
Add |
void | |
Add |
void | |
Clear |
void | |
Contains |
bool | |
ContainsKey |
bool |
Whether or not the metadata contains the specified key.
|
CopyTo |
void | |
Get |
Object |
Gets the value for the specified key. This method never throws an exception. It will return the specified
default value or null if the key is not found.
|
Get |
T |
Gets the value for the specified key converted to the specified type.
This method never throws an exception. It will return default(T) if the key is not found
or the value cannot be converted to T.
|
Get |
T |
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.
|
GetEnumerator |
IEnumerator |
|
GetMetadata |
IMetadata |
Gets a new
Wyam.Common.Meta.IMetadata containing only the specified keys and their values. If a key is not present in the current
metadata, it will be ignored and will not be copied to the new metadata object.
|
GetRaw |
Object |
Gets the raw value for the specified key. This method will not materialize
Wyam.Common.Meta.IMetadataValue
values the way Wyam.Common.Meta.IMetadata.Get(System.String,System.Object) will. A System.Collections.Generic.KeyNotFoundException will be thrown
for missing keys.
|
MetadataAs |
IMetadata |
Presents metadata values as a specific type (see
Wyam.Common.Meta.IMetadata ).
|
Remove |
bool | |
Remove |
bool | |
TryGetValue |
bool |
Attempts to get a value from metadata.
|
TryGetValue |
bool |
Tries to get the value for the specified key.
|