Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
CiStringToString.cs
1using System;
6
8{
13 {
17 public Type From => typeof(CaseInsensitiveString);
18
22 public Type To => typeof(string);
23
29 public double Weight => 1.0;
30
37 public bool TryConvert(object Value, out object Result)
38 {
39 if (Value is null)
40 {
41 Result = null;
42 return true;
43 }
44 else if (Value is CaseInsensitiveString s)
45 {
46 Result = s.Value;
47 return true;
48 }
49 else
50 {
51 Result = null;
52 return false;
53 }
54 }
55
63 public bool TryConvertToElement(object Value, out IElement Result)
64 {
65 if (Value is null)
66 {
67 Result = ObjectValue.Null;
68 return true;
69 }
70 else if (Value is CaseInsensitiveString s)
71 {
72 Result = new StringValue(s.Value);
73 return true;
74 }
75 else
76 {
77 Result = null;
78 return false;
79 }
80 }
81 }
82}
Represents a case-insensitive string.
static readonly ObjectValue Null
Null value.
Definition: ObjectValue.cs:88
Converts case-insensitive strings to normal strings.
bool TryConvertToElement(object Value, out IElement Result)
Converts the object in Value to an object of type To, encapsulated in an IElement.
Type From
Converter converts objects of this type.
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.
Type To
Converter converts objects to this type.
Basic interface for all types of elements.
Definition: IElement.cs:21
Converts an object of one type to an object of another type.