Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
StringFieldToString.cs
1using System;
6
8{
13 {
18 {
19 }
20
24 public Type From => typeof(StringField);
25
29 public Type To => typeof(String);
30
36 public double Weight => 0.5;
37
44 public bool TryConvert(object Value, out object Result)
45 {
46 if (Value is StringField Field)
47 {
48 Result = Field.Value;
49 return true;
50 }
51 else
52 {
53 Result = null;
54 return false;
55 }
56 }
57
65 public bool TryConvertToElement(object Value, out IElement Result)
66 {
67 if (Value is StringField Field)
68 {
69 Result = new StringValue(Field.Value);
70 return true;
71 }
72 else
73 {
74 Result = null;
75 return false;
76 }
77 }
78 }
79}
Base class for all sensor data fields.
Definition: Field.cs:20
Represents a string value.
Definition: StringField.cs:10
Type From
Converter converts objects of this type.
StringFieldToString()
Converts a StringField to a String.
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.
bool TryConvertToElement(object Value, out IElement Result)
Converts the object in Value to an object of type To, encapsulated in an IElement.
double Weight
Weight of the converter. An estimate of how well the converter performs, or how much information is r...
Basic interface for all types of elements.
Definition: IElement.cs:21
Converts an object of one type to an object of another type.