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
37 public double Weight => 0.5;
38
45 public bool TryConvert(object Value, out object Result)
46 {
47 if (Value is DurationField Field)
48 {
49 Result = Field.Value;
50 return true;
51 }
52 else
53 {
54 Result = null;
55 return false;
56 }
57 }
58
66 public bool TryConvertToElement(object Value, out IElement Result)
67 {
68 if (Value is DurationField Field)
69 {
70 Result = new ObjectValue(Field.Value);
71 return true;
72 }
73 else
74 {
75 Result = null;
76 return false;
77 }
78 }
79 }
80}
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
double Weight
Weight of the converter. An estimate of how well the converter performs, or how much information is r...
bool TryConvert(object Value, out object Result)
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.
DurationFieldToDuration()
Converts a DurationField to a Duration.
bool TryConvertToElement(object Value, out IElement Result)
Converts the object in Value to an object of type To, encapsulated in an IElement.
Basic interface for all types of elements.
Definition: IElement.cs:21
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:14