**** Merged from MCS ****
[mono-project.git] / mcs / class / System.Data.ObjectSpaces / System.Data.ObjectSpaces.Schema / ExtendedPropertyCollection.cs
blob9b6eb387ce69f9b8d802bfb57753586058217886
1 //
2 // System.Data.ObjectSpaces.Schema.ExtendedPropertyCollection.cs
3 //
4 // Author:
5 // Tim Coleman (tim@timcoleman.com)
6 //
7 // Copyright (C) Tim Coleman, 2003
8 //
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:
18 //
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 //
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 #if NET_2_0
33 using System.Collections;
34 using System.Xml;
36 namespace System.Data.ObjectSpaces.Schema {
37 public class ExtendedPropertyCollection : CollectionBase
39 #region Fields
41 ArrayList qnames;
43 #endregion
45 #region Constructors
47 public ExtendedPropertyCollection ()
49 qnames = new ArrayList();
52 public ExtendedPropertyCollection (ExtendedProperty[] value)
53 : this ()
55 AddRange (value);
58 public ExtendedPropertyCollection (ExtendedPropertyCollection value)
59 : this ()
61 AddRange (value);
64 #endregion // Constructors
66 #region Properties
68 public ExtendedProperty this [int obj] {
69 get { return (ExtendedProperty) List [obj]; }
70 set {
71 List [obj] = value;
72 qnames [obj] = value.QualifiedName;
76 [MonoTODO]
77 public ExtendedProperty this [XmlQualifiedName type] {
78 get { return (ExtendedProperty) List [qnames.IndexOf (type)]; }
79 set { List [qnames.IndexOf (type)] = value; }
82 #endregion // Properties
84 #region Methods
86 public void Add (ExtendedProperty value)
88 Insert (Count, value);
91 public void AddRange (ExtendedProperty[] value)
93 foreach (ExtendedProperty p in value)
94 Add (p);
97 public void AddRange (ExtendedPropertyCollection value)
99 foreach (ExtendedProperty p in value)
100 Add (p);
103 public bool Contains (ExtendedProperty value)
105 return List.Contains (value);
108 public void CopyTo (ExtendedProperty[] array, int index)
110 List.CopyTo (array, index);
113 public int IndexOf (ExtendedProperty value)
115 return List.IndexOf (value);
118 [MonoTODO]
119 public void Insert (int index, ExtendedProperty value)
121 List.Insert (index, value);
122 qnames [index] = value.QualifiedName;
125 [MonoTODO]
126 protected override void OnInsert (int index, object value)
130 [MonoTODO]
131 protected override void OnRemove (int index, object value)
135 [MonoTODO]
136 public void Remove (ExtendedProperty value)
138 int index = IndexOf (value);
139 List.Remove (value);
140 qnames.RemoveAt (index);
143 #endregion // Methods
147 #endif // NET_2_0