Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
DateFieldToDateTime.cs
1using System;
6
8{
13 {
18 {
19 }
20
24 public Type From => typeof(DateField);
25
29 public Type To => typeof(DateTime);
30
36 public double Weight => 0.5;
37
44 public bool TryConvert(object Value, out object Result)
45 {
46 if (Value is DateField 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 DateField Field)
68 {
69 Result = new DateTimeValue(Field.Value);
70 return true;
71 }
72 else
73 {
74 Result = null;
75 return false;
76 }
77 }
78 }
79}
Represents a date value.
Definition: DateField.cs:11
Base class for all sensor data fields.
Definition: Field.cs:20
Converts a DateField to a DateTime.
Type To
Converter converts objects to this type.
bool TryConvertToElement(object Value, out IElement Result)
Converts the object in Value to an object of type To, encapsulated in an IElement.
Type From
Converter converts objects of this type.
DateFieldToDate()
Converts a DateField to a DateTime.
bool TryConvert(object Value, out object Result)
Converts the object in Value to an object of type To.
double Weight
Weight of the converter. An estimate of how well the converter performs, or how much information is r...
Basic interface for all types of elements.
Definition: IElement.cs:21
Converts an object of one type to an object of another type.