Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
StringToBigInteger.cs
1using System;
2using System.Numerics;
5
7{
12 {
16 public Type From => typeof(string);
17
21 public Type To => typeof(BigInteger);
22
28 public double Weight => 0.5;
29
36 public bool TryConvert(object Value, out object Result)
37 {
38 if (Value is string s && BigInteger.TryParse(s, out BigInteger i))
39 {
40 Result = i;
41 return true;
42 }
43 else
44 {
45 Result = null;
46 return false;
47 }
48 }
49
57 public bool TryConvertToElement(object Value, out IElement Result)
58 {
59 if (Value is string s && BigInteger.TryParse(s, out BigInteger i))
60 {
61 Result = new Integer(i);
62 return true;
63 }
64 else
65 {
66 Result = null;
67 return false;
68 }
69 }
70 }
71}
Integer-valued number.
Definition: Integer.cs:13
Converts a string value to a BigInteger, if possible.
bool TryConvertToElement(object Value, out IElement Result)
Converts the object in Value to an object of type To, encapsulated in an IElement.
Type To
Converter converts objects to this type.
double Weight
Weight of the converter. An estimate of how well the converter performs, or how much information is r...
Type From
Converter converts objects of this type.
bool TryConvert(object Value, out object Result)
Converts the object in Value to an object of type To.
Basic interface for all types of elements.
Definition: IElement.cs:21
Converts an object of one type to an object of another type.