Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
StringToCiString.cs
1using System;
6
8{
13 {
17 public Type From => typeof(string);
18
22 public Type To => typeof(CaseInsensitiveString);
23
30 public object Convert(object Value)
31 {
32 if (Value is null)
33 return null;
34
35 if (!(Value is string String))
36 throw new ArgumentException("Expected string.", nameof(Value));
37
38 return (CaseInsensitiveString)String;
39 }
40
48 public IElement ConvertToElement(object Value)
49 {
50 if (Value is null)
51 return ObjectValue.Null;
52
53 if (!(Value is string String))
54 throw new ArgumentException("Expected string.", nameof(Value));
55
56 return new ObjectValue((CaseInsensitiveString)String);
57 }
58 }
59}
Represents a case-insensitive string.
static readonly ObjectValue Null
Null value.
Definition: ObjectValue.cs:86
Converts normal strings to case-insensitive strings.
object Convert(object Value)
Converts the object in Value to an object of type To.
Type From
Converter converts objects of this type.
IElement ConvertToElement(object Value)
Converts the object in Value to an object of type To, encapsulated in an IElement.
Type To
Converter converts objects to this type.
Basic interface for all types of elements.
Definition: IElement.cs:20
Converts an object of one type to an object of another type.