Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
NamedDictionary.cs
4
5namespace Waher.Content
6{
13 public class NamedDictionary<TKey, TValue> : Dictionary<TKey, TValue>
14 {
19 : base()
20 {
21 }
22
28 public NamedDictionary(string LocalName, string Namespace)
29 : base()
30 {
31 this.LocalName = LocalName;
32 this.Namespace = Namespace;
33 }
34
39 public NamedDictionary(IDictionary<TKey, TValue> Dictionary)
40 : base(Dictionary)
41 {
42 }
43
48 public NamedDictionary(IEqualityComparer<TKey> Comparer)
49 : base(Comparer)
50 {
51 }
52
57 public NamedDictionary(int Capacity)
58 : base(Capacity)
59 {
60 }
61
67 public NamedDictionary(IDictionary<TKey, TValue> Dictionary, IEqualityComparer<TKey> Comparer)
68 : base(Dictionary, Comparer)
69 {
70 }
71
77 public NamedDictionary(int Capacity, IEqualityComparer<TKey> Comparer)
78 : base(Capacity, Comparer)
79 {
80 }
81
86 public static NamedDictionary<string, object> ToNamedDictionary(IEnumerable<KeyValuePair<string, IElement>> Dictionary)
87 {
89
90 foreach (KeyValuePair<string, IElement> P in Dictionary)
91 {
92 switch (P.Key)
93 {
94 case "__name":
95 case "__local":
96 Result.LocalName = ScriptNode.ToString(P.Value) ?? string.Empty;
97 break;
98
99 case "__namespace":
100 case "__xmlns":
101 Result.Namespace = ScriptNode.ToString(P.Value) ?? string.Empty;
102 break;
103
104 default:
105 Result[P.Key] = P.Value.AssociatedObjectValue;
106 break;
107 }
108 }
109
110 return Result;
111 }
112
116 public string LocalName { get; set; }
117
121 public string Namespace { get; set; }
122 }
123}
A Named dictionary is a dictionary, with a local name and a namespace. Use it to return content that ...
string LocalName
Local Name of dictionary.
static NamedDictionary< string, object > ToNamedDictionary(IEnumerable< KeyValuePair< string, IElement > > Dictionary)
Creates a Named Dictionary from a script object ex-nihilo
NamedDictionary(int Capacity, IEqualityComparer< TKey > Comparer)
A Named dictionary is a dictionary, with a local name and a namespace.
NamedDictionary(int Capacity)
A Named dictionary is a dictionary, with a local name and a namespace.
NamedDictionary(IDictionary< TKey, TValue > Dictionary, IEqualityComparer< TKey > Comparer)
A Named dictionary is a dictionary, with a local name and a namespace.
NamedDictionary()
A Named dictionary is a dictionary, with a local name and a namespace.
NamedDictionary(IDictionary< TKey, TValue > Dictionary)
A Named dictionary is a dictionary, with a local name and a namespace.
string Namespace
Namespace of dictionary.
NamedDictionary(IEqualityComparer< TKey > Comparer)
A Named dictionary is a dictionary, with a local name and a namespace.
NamedDictionary(string LocalName, string Namespace)
A Named dictionary is a dictionary, with a local name and a namespace.
Base class for all nodes in a parsed script tree.
Definition: ScriptNode.cs:69
override string ToString()
Definition: ScriptNode.cs:359