A mutable
IMetadata
implementation that works like a dictionary.
- Namespace
- Statiq
.Common - Interfaces
-
- IDictionary
<string, object> - ICollection
<KeyValuePair <string, object> > - IMetadata
- IReadOnlyDictionary
<string, object> - IReadOnlyCollection
<KeyValuePair <string, object> > - IEnumerable
<KeyValuePair <string, object> > - IEnumerable
- IDictionary
- Implementing Types
graph BT
Type-.->Interface0["IDictionary<string, object>"]
Type-.->Interface1["ICollection<KeyValuePair<string, object>>"]
Type-.->Interface2["IMetadata"]
click Interface2 "/api/Statiq.Common/IMetadata"
Type-.->Interface3["IReadOnlyDictionary<string, object>"]
Type-.->Interface4["IReadOnlyCollection<KeyValuePair<string, object>>"]
Type-.->Interface5["IEnumerable<KeyValuePair<string, object>>"]
Type-.->Interface6["IEnumerable"]
Type["IMetadataDictionary"]
class Type type-node
Implementing0["MetadataDictionary"]-.->Type
click Implementing0 "/api/Statiq.Common/MetadataDictionary"
Implementing1["ConvertingDictionary"]-.->Type
click Implementing1 "/api/Statiq.Common/ConvertingDictionary"
Syntax
public interface IMetadataDictionary : IDictionary<string, object>,
ICollection<KeyValuePair<string, object>>, IMetadata, IReadOnlyDictionary<string, object>,
IReadOnlyCollection<KeyValuePair<string, object>>, IEnumerable<KeyValuePair<string, object>>,
IEnumerable
Properties
Name | Property Type | Summary |
---|---|---|
Count | int |
The count of metadata.
|
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 | Return Value | Summary |
---|---|---|
ContainsKey |
bool |
Whether or not the metadata contains the specified key.
|
TryGetValue |
bool |
Attempts to get a value from metadata.
|
Extension Methods
Name | Value | Summary |
---|---|---|
AddOrReplaceRange |
void | |
AddRange |
void |
Adds a range of values to a collection.
|
AddRange |
void |
Adds a range of values to a collection.
|
Concat |
IEnumerable |
|
ContainsAnyKeys |
bool |
Determines whether the dictionary contains all the specified keys.
|
ContainsAnyKeys |
bool |
Determines whether the dictionary contains all the specified keys.
|
ContainsKeys |
bool |
Determines whether the dictionary contains all the specified keys.
|
ContainsKeys |
bool |
Determines whether the dictionary contains all the specified keys.
|
FilterMetadata |
IMetadata |
Gets a new filtered
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.
|
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 or is
null .
|
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 or is
null .
|
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,
is
null , or the value cannot be converted to T.
|
GetBool |
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.
|
GetDateTime |
DateTime |
Gets the value for the specified key converted to a
DateTime . This method never throws an exception. It will return the specified
default value if the key is not found.
|
GetDateTimeOffset |
DateTimeOffset |
Gets the value for the specified key converted to a
DateTimeOffset . This method never throws an exception. It will return the specified
default value if the key is not found.
|
GetDocument |
IDocument |
Gets the value for the specified key converted to a
IDocument . This method never throws an exception.
It will return null if the key is not found.
|
GetDocumentList |
DocumentList |
Gets the value for the specified key converted to a
DocumentList<TDocument> . This method never throws an exception.
It will return an empty list if the key is not found or if the key is found but contains no items that can be converted to IDocument .
|
GetDocumentList |
DocumentList |
Gets the value for the specified key converted to a
DocumentList<TDocument> . This method never throws an exception.
It will return an empty list if the key is not found or if the key is found but contains no items that can be converted to the specified document type.
|
GetDocuments |
IEnumerable |
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 IDocument .
|
GetDocuments |
IEnumerable |
Gets the value for the specified key converted to a
IReadOnlyList<TDocument> . 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 the specified document type.
|
GetDynamic |
dynamic |
Gets the value associated with the specified key as a dynamic object. This is equivalent
to calling
as dynamic to cast the value.
|
GetEnumerable |
IEnumerable |
Gets an enumerable that enumerates key-value pairs.
|
GetInt |
int |
Gets the value for the specified key converted to an int. This method never throws an exception. It will return the specified
default value if the key is not found.
|
GetList |
IReadOnlyList |
Gets the value for the specified key converted to a
IReadOnlyList<T> . 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.
|
GetMetadata |
IMetadata |
Gets the value for the specified key converted to a nested
IMetadata . This method never throws an exception.
It will return null if the key is not found.
|
GetNext |
T | |
GetNext |
T | |
GetPath |
NormalizedPath |
Gets the value for the specified key converted to a
NormalizedPath . This method never throws an exception.
It will return the specified default value if the key is not found.
|
GetPrevious |
T | |
GetPrevious |
T | |
GetRaw |
object |
Gets the raw value for the specified key. This method will not materialize
IMetadataValue
values the way other get methods will. A System.Collections.Generic.KeyNotFoundException will be thrown
for missing keys.
|
GetRawEnumerable |
IEnumerable |
Gets an enumerable that enumerates raw key-value pairs
(I.e., the values have not been expanded similar to
TryGetRaw(string, object) ).
|
GetString |
string |
Formats a string value if it exists in the metadata, otherwise returns a default value.
|
GetString |
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.
|
GroupByMany |
IEnumerable |
Groups the elements of a sequence according to a specified key selector function
that returns a sequence of keys.
The keys are compared by using a comparer and each group's elements
are projected by using a specified function.
From GroupByExtensions
|
GroupByMany |
IEnumerable |
Groups the elements of a sequence according to a specified key selector function
that returns a sequence of keys
and projects the elements for each group by using a specified function.
From GroupByExtensions
|
GroupByMany |
IEnumerable |
Groups the elements of a sequence according to a specified key selector function
that returns a sequence of keys
and compares the keys by using a specified comparer.
From GroupByExtensions
|
GroupByMany |
IEnumerable |
Groups the elements of a sequence according to a specified key selector function
that returns a sequence of keys.
From GroupByExtensions
|
GroupByManyToMany |
IEnumerable |
Groups the elements of a sequence according to a specified key selector function
that returns a sequence of keys.
The keys are compared by using a comparer and each group's elements
are projected by using a specified function
that returns a sequence of elements.
From GroupByExtensions
|
GroupByManyToMany |
IEnumerable |
Groups the elements of a sequence according to a specified key selector function
that returns a sequence of keys
and projects the elements for each group by using a specified function
that returns a sequence of elements.
From GroupByExtensions
|
ParallelForEachAsync |
Task | |
ParallelSelectAsync |
Task |
Invokes an async selector in parallel.
|
Parallel |
Task |
Invokes an async selector that returns multiple results in parallel.
|
ParallelWhereAsync |
Task |
|
RemoveAll |
int |
Removes all items that match a predicate from a collection.
|
RequireKeys |
void |
Verifies that a dictionary contains all requires keys.
An
System.ArgumentException will be thrown if the
specified keys are not all present in the dictionary.
|
RequireKeys |
void |
Verifies that a dictionary contains all requires keys.
An
System.ArgumentException will be thrown if the
specified keys are not all present in the dictionary.
|
StartsWith |
bool |
Determines whether the items starts with the specified values.
|
StartsWith |
bool |
Determines whether the items starts with the specified values.
|
ThrowIfNull |
T |
From GuardExtensions
|
ToDocument |
IDocument | |
ToDocument |
IDocument | |
ToDocument |
IDocument | |
ToDocument |
IDocument | |
ToDocument |
IDocument | |
ToDocument |
IDocument | |
ToDocuments |
IEnumerable |
|
ToDocuments |
IEnumerable |
|
ToDocuments |
IEnumerable |
|
ToDocuments |
IEnumerable |
|
ToDocuments |
IEnumerable |
|
ToDocuments |
IEnumerable |
|
ToJson |
string | |
ToLookupMany |
ILookup |
Creates a lookup from a sequence according to a specified key selector function
that returns a sequence of keys.
The keys are compared by using a comparer and each group's elements
are projected by using a specified function.
From ToLookupExtensions
|
ToLookupMany |
ILookup |
Creates a lookup from a sequence according to a specified key selector function
that returns a sequence of keys
and projects the elements for each group by using a specified function.
From ToLookupExtensions
|
ToLookupMany |
ILookup |
Creates a lookup from a sequence according to a specified key selector function
that returns a sequence of keys
and compares the keys by using a specified comparer.
From ToLookupExtensions
|
ToLookupMany |
ILookup |
Creates a lookup from a sequence according to a specified key selector function
that returns a sequence of keys.
From ToLookupExtensions
|
ToLookupManyToMany |
ILookup |
Creates a lookup from a sequence according to a specified key selector function
that returns a sequence of keys.
The keys are compared by using a comparer and each group's elements
are projected by using a specified function
that returns a sequence of elements.
From ToLookupExtensions
|
ToLookupManyToMany |
ILookup |
Creates a lookup from a sequence according to a specified key selector function
that returns a sequence of keys
and projects the elements for each group by using a specified function
that returns a sequence of elements.
From ToLookupExtensions
|
ToStringTable |
string | |
TryAdd |
bool | |
TryAdd |
bool | |
TryAddRange |
void | |
TryGetValue |
bool |
Tries to get the value for the specified key.
|
WithoutSettings |
IMetadata | |
XAttribute |
XAttribute | |
XAttribute |
XAttribute | |
XAttribute |
XAttribute | |
XAttribute |
XAttribute |
Gets an XML attribute for the given metadata key.
|
XAttribute |
XAttribute |
Gets an XML attribute for the given metadata key.
The name of the attribute will be the lower-case key name.
|
XElement |
XElement | |
XElement |
XElement | |
XElement |
XElement |