Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
DoubleToDecimal.cs
1using System;
5
7{
12 {
16 public Type From => typeof(double);
17
21 public Type To => typeof(decimal);
22
29 public object Convert(object Value)
30 {
31 if (Value is double d)
32 return (decimal)d;
33 else
34 throw new ArgumentException("Expected double value.", nameof(Value));
35 }
36
44 public IElement ConvertToElement(object Value)
45 {
46 if (Value is double d)
47 return new ObjectValue((decimal)d);
48 else
49 throw new ArgumentException("Expected double value.", nameof(Value));
50 }
51 }
52}
Converts double numbers to decimal numbers.
object Convert(object Value)
Converts the object in Value to an object of type To.
Type To
Converter converts objects to this type.
Type From
Converts double numbers to decimal numbers.
IElement ConvertToElement(object Value)
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:20
Converts an object of one type to an object of another type.