Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
StringToInt64.cs
1using System;
2using System.Globalization;
5
7{
12 {
16 public Type From => typeof(string);
17
21 public Type To => typeof(long);
22
28 public double Weight => 0.5;
29
36 public bool TryConvert(object Value, out object Result)
37 {
38 if (Value is string s && long.TryParse(s, NumberStyles.Integer, null, out long 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 && long.TryParse(s, NumberStyles.Integer, null, out long i))
60 {
61 Result = new ObjectValue(i);
62 return true;
63 }
64 else
65 {
66 Result = null;
67 return false;
68 }
69 }
70 }
71}
Converts string values to 64-bit integer values.
double Weight
Weight of the converter. An estimate of how well the converter performs, or how much information is r...
bool TryConvert(object Value, out object Result)
Converts the object in Value to an object of type To.
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.
Type From
Converts string values to 64-bit integer values.
Basic interface for all types of elements.
Definition: IElement.cs:21
Converts an object of one type to an object of another type.