Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
JoinAttributes.cs
1using System.Collections;
2using System.Xml;
3
5{
9 public class JoinAttributes : IEnumerable
10 {
11 private readonly XmlAttributeCollection attributes1;
12 private readonly XmlAttributeCollection attributes2;
13
19 public JoinAttributes(XmlAttributeCollection Attributes1, XmlAttributeCollection Attributes2)
20 {
21 this.attributes1 = Attributes1;
22 this.attributes2 = Attributes2;
23 }
24
29 public IEnumerator GetEnumerator()
30 {
31 return new JoinedAttributesEnumerator(this.attributes1.GetEnumerator(),
32 this.attributes2.GetEnumerator());
33 }
34
38 private class JoinedAttributesEnumerator : IEnumerator
39 {
40 private readonly IEnumerator enumerator1;
41 private readonly IEnumerator enumerator2;
42 private bool first;
43
49 public JoinedAttributesEnumerator(IEnumerator e1, IEnumerator e2)
50 {
51 this.enumerator1 = e1;
52 this.enumerator2 = e2;
53 this.first = true;
54 }
55
59 public object Current
60 {
61 get
62 {
63 if (this.first)
64 return (XmlAttribute)this.enumerator1.Current;
65 else
66 return (XmlAttribute)this.enumerator2.Current;
67 }
68 }
69
74 public bool MoveNext()
75 {
76 if (this.first)
77 {
78 if (this.enumerator1.MoveNext())
79 return true;
80 else
81 this.first = false;
82 }
83
84 return this.enumerator2.MoveNext();
85 }
86
90 public void Reset()
91 {
92 this.enumerator1.Reset();
93 this.enumerator2.Reset();
94
95 this.first = true;
96 }
97 }
98 }
99}
Joins attributes from two XML elements.
JoinAttributes(XmlAttributeCollection Attributes1, XmlAttributeCollection Attributes2)
Joins attributes from two XML elements.
IEnumerator GetEnumerator()
Gets an enumerator over the concatentation of attributes from the two elements.