2 // XmlElementAttributes.cs:
5 // John Donagher (john@webmeta.com)
7 // (C) 2002 John Donagher
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 using System
.Collections
;
32 using System
.Collections
.Generic
;
34 namespace System
.Xml
.Serialization
37 /// Summary description for XmlElementAttributes.
40 public class XmlElementAttributes
: IList
{
42 private List
<XmlElementAttribute
> List
= new List
<XmlElementAttribute
> ();
44 int IList
.Add (object value)
46 return (List
as IList
).Add (value);
54 bool IList
.Contains (object value)
56 return (List
as IList
).Contains (value);
59 int IList
.IndexOf (object value)
61 return (List
as IList
).IndexOf (value);
64 void IList
.Insert (int index
, object value)
66 (List
as IList
).Insert (index
, value);
69 bool IList
.IsFixedSize
{
70 get { return (List as IList).IsFixedSize; }
73 bool IList
.IsReadOnly
{
74 get { return (List as IList).IsReadOnly; }
77 void IList
.Remove (object value)
79 (List
as IList
).Remove (value);
82 void IList
.RemoveAt (int index
)
84 List
.RemoveAt (index
);
87 object IList
.this [int index
] {
88 get { return (List as IList) [index]; }
89 set { (List as IList) [index] = value; }
92 void ICollection
.CopyTo (Array array
, int index
)
94 (List
as ICollection
).CopyTo (array
, index
);
98 get { return List.Count; }
101 bool ICollection
.IsSynchronized
{
102 get { return (List as ICollection).IsSynchronized; }
105 object ICollection
.SyncRoot
{
106 get { return (List as ICollection).SyncRoot; }
109 IEnumerator IEnumerable
.GetEnumerator ()
111 return (List
as IEnumerable
).GetEnumerator ();
114 public class XmlElementAttributes
: CollectionBase
{
116 public XmlElementAttribute
this [int index
] {
118 return (XmlElementAttribute
)List
[index
];
121 List
[index
] = value;
125 public int Add (XmlElementAttribute attribute
)
127 return (List
as IList
).Add (attribute
);
130 public bool Contains(XmlElementAttribute attribute
)
132 return List
.Contains(attribute
);
135 public int IndexOf(XmlElementAttribute attribute
)
137 return List
.IndexOf(attribute
);
140 public void Insert(int index
, XmlElementAttribute attribute
)
142 List
.Insert(index
, attribute
);
145 public void Remove(XmlElementAttribute attribute
)
147 List
.Remove(attribute
);
150 public void CopyTo(XmlElementAttribute
[] array
,int index
)
152 List
.CopyTo(array
, index
);
155 internal void AddKeyHash (System
.Text
.StringBuilder sb
)
157 if (Count
== 0) return;
160 for (int n
=0; n
<Count
; n
++)
161 this[n
].AddKeyHash (sb
);
167 foreach (XmlElementAttribute e
in this)