Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
QuantityFieldToPhysicalQuantity.cs
1using System;
6
8{
13 {
18 {
19 }
20
24 public Type From => typeof(QuantityField);
25
29 public Type To => typeof(PhysicalQuantity);
30
36 public double Weight => 0.5;
37
44 public bool TryConvert(object Value, out object Result)
45 {
46 if (Value is QuantityField Field)
47 {
48 Result = Field.Quantity;
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 QuantityField Field)
68 {
69 Result = Field.Quantity;
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 physical quantity value.
bool TryConvert(object Value, out object Result)
Converts the object in Value to an object of type To.
QuantityFieldToPhysicalQuantity()
Converts a QuantityField to a PhysicalQuantity.
bool TryConvertToElement(object Value, out IElement Result)
Converts the object in Value to an object of type To, encapsulated in an IElement.
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.