Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
EnumFieldToEnum.cs
1using System;
6
8{
13 {
18 {
19 }
20
24 public Type From => typeof(EnumField);
25
29 public Type To => typeof(Enum);
30
36 public double Weight => 0.5;
43 public bool TryConvert(object Value, out object Result)
44 {
45 if (Value is EnumField Field)
46 {
47 Result = Field.Value;
48 return true;
49 }
50 else
51 {
52 Result = null;
53 return false;
54 }
55 }
56
64 public bool TryConvertToElement(object Value, out IElement Result)
65 {
66 if (Value is EnumField Field)
67 {
68 Result = new ObjectValue(Field.Value);
69 return true;
70 }
71 else
72 {
73 Result = null;
74 return false;
75 }
76 }
77 }
78}
Represents a enum value.
Definition: EnumField.cs:11
Base class for all sensor data fields.
Definition: Field.cs:20
Converts a EnumField to a Enum.
EnumFieldToEnum()
Converts a EnumField to a Enum.
bool TryConvertToElement(object Value, out IElement Result)
Converts the object in Value to an object of type To, encapsulated in an IElement.
bool TryConvert(object Value, out object Result)
Converts the object in Value to an object of type To.
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...
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.