Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
TimeFieldToTimeSpan.cs
1using System;
6
8{
13 {
18 {
19 }
20
24 public Type From => typeof(TimeField);
25
29 public Type To => typeof(TimeSpan);
30
36 public double Weight => 0.5;
37
44 public bool TryConvert(object Value, out object Result)
45 {
46 if (Value is TimeField Field)
47 {
48 Result = Field.Value;
49 return true;
50 }
51 else
52 {
53 Result = null;
54 return false;
55 }
56 }
57
65 public bool TryConvertToElement(object Value, out IElement Result)
66 {
67 if (Value is TimeField Field)
68 {
69 Result = new ObjectValue(Field.Value);
70 return true;
71 }
72 else
73 {
74 Result = null;
75 return false;
76 }
77 }
78 }
79}
Base class for all sensor data fields.
Definition: Field.cs:20
Represents a time value. Time values adhere to the type specified by xsd:time.
Definition: TimeField.cs:14
double Weight
Weight of the converter. An estimate of how well the converter performs, or how much information is r...
Type From
Converter converts objects of this type.
Type To
Converter converts objects to this type.
TimeFieldToTimeSpan()
Converts a TimeField to a TimeSpan.
bool TryConvert(object Value, out object Result)
Converts the object in Value to an object of type To.
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.