Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
DoubleToComplex.cs
1using System;
2using System.Numerics;
5
7{
12 {
16 public Type From => typeof(double);
17
21 public Type To => typeof(Complex);
22
29 public object Convert(object Value)
30 {
31 if (Value is double d)
32 return new Complex(d, 0);
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 ComplexNumber(d, 0);
48 else
49 throw new ArgumentException("Expected double value.", nameof(Value));
50 }
51 }
52}
Converts double numbers to complex numbers
object Convert(object Value)
Converts the object in Value to an object of type To.
Type From
Converter converts objects of this type.
IElement ConvertToElement(object Value)
Converts the object in Value to an object of type To, encapsulated in an IElement.
Type To
Converter converts objects to this type.
Basic interface for all types of elements.
Definition: IElement.cs:20
Converts an object of one type to an object of another type.