Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
EnumToDouble.cs
1using System;
4
6{
11 {
15 public Type From => typeof(Enum);
16
20 public Type To => typeof(double);
21
28 public object Convert(object Value)
29 {
30 if (Value is Enum e)
31 return (double)System.Convert.ToInt32(e);
32 else
33 throw new ArgumentException("Expected enumeration value.", nameof(Value));
34 }
35
43 public IElement ConvertToElement(object Value)
44 {
45 if (Value is Enum e)
46 return new DoubleNumber(System.Convert.ToInt32(e));
47 else
48 throw new ArgumentException("Expected enumeration value.", nameof(Value));
49 }
50 }
51}
Converts enumerated values to double numbers.
Definition: EnumToDouble.cs:11
IElement ConvertToElement(object Value)
Converts the object in Value to an object of type To, encapsulated in an IElement.
Definition: EnumToDouble.cs:43
object Convert(object Value)
Converts the object in Value to an object of type To.
Definition: EnumToDouble.cs:28
Type From
Converts enumerated values to short numbers.
Definition: EnumToDouble.cs:15
Type To
Converter converts objects to this type.
Definition: EnumToDouble.cs:20
Basic interface for all types of elements.
Definition: IElement.cs:20
Converts an object of one type to an object of another type.