Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
DurationFieldToDuration.cs
1using System;
2using Waher.Content;
7
9{
14 {
19 {
20 }
21
25 public Type From => typeof(DurationField);
26
30 public Type To => typeof(Duration);
31
38 public object Convert(object Value)
39 {
40 if (Value is DurationField Field)
41 return Field.Value;
42 else
43 throw new ArgumentException("Not a DurationField.", nameof(Value));
44 }
45
53 public IElement ConvertToElement(object Value)
54 {
55 if (Value is DurationField Field)
56 return new ObjectValue(Field.Value);
57 else
58 throw new ArgumentException("Not a DurationField.", nameof(Value));
59 }
60 }
61}
Represents a duration value. Duration values adhere to the type specified by xsd:duration.
Base class for all sensor data fields.
Definition: Field.cs:20
object Convert(object Value)
Converts the object in Value to an object of type To.
Type From
Converter converts objects of this type.
Type To
Converter converts objects to this type.
IElement ConvertToElement(object Value)
Converts the object in Value to an object of type To, encapsulated in an IElement.
DurationFieldToDuration()
Converts a DurationField to a Duration.
Basic interface for all types of elements.
Definition: IElement.cs:20
Converts an object of one type to an object of another type.
Represents a duration value, as defined by the xsd:duration data type: http://www....
Definition: Duration.cs:13