Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
PhysicalQuantityToPersistableQuantity.cs
1using System;
2using Waher.Content;
7
9{
14 {
19 {
20 }
21
25 public Type From => typeof(PhysicalQuantity);
26
30 public Type To => typeof(PersistableQuantity);
31
38 public object Convert(object Value)
39 {
40 if (Value is IPhysicalQuantity PQ)
41 {
44 }
45 else
46 throw new ArgumentException("Not a PhysicalQuantity.", nameof(Value));
47 }
48
56 public IElement ConvertToElement(object Value)
57 {
58 if (Value is IPhysicalQuantity PQ)
59 {
62 }
63 else
64 throw new ArgumentException("Not a PhysicalQuantity.", nameof(Value));
65 }
66 }
67}
Helps with parsing of commong data types.
Definition: CommonTypes.cs:13
static byte GetNrDecimals(double x)
Calculates the number of decimals of a floating-point number.
Definition: CommonTypes.cs:903
PhysicalQuantity ToPhysicalQuantity()
Converts underlying object to a physical quantity.
object Convert(object Value)
Converts the object in Value to an object of type To.
IElement ConvertToElement(object Value)
Converts the object in Value to an object of type To, encapsulated in an IElement.
PhysicalQuantityToPersistableQuantity()
Converts a PhysicalQuantity to a PersistableQuantity.
Basic interface for all types of elements.
Definition: IElement.cs:20
Interface for objects that can be represented as a physical quantity.
Converts an object of one type to an object of another type.