2 // System.Data.ObjectSpaces.Schema.ExtendedPropertyCollection.cs
5 // Tim Coleman (tim@timcoleman.com)
7 // Copyright (C) Tim Coleman, 2003
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.
33 using System
.Collections
;
36 namespace System
.Data
.ObjectSpaces
.Schema
{
37 public class ExtendedPropertyCollection
: CollectionBase
47 public ExtendedPropertyCollection ()
49 qnames
= new ArrayList();
52 public ExtendedPropertyCollection (ExtendedProperty
[] value)
58 public ExtendedPropertyCollection (ExtendedPropertyCollection
value)
64 #endregion // Constructors
68 public ExtendedProperty
this [int obj
] {
69 get { return (ExtendedProperty) List [obj]; }
72 qnames
[obj
] = value.QualifiedName
;
77 public ExtendedProperty
this [XmlQualifiedName type
] {
78 get { return (ExtendedProperty) List [qnames.IndexOf (type)]; }
79 set { List [qnames.IndexOf (type)] = value; }
82 #endregion // Properties
86 public void Add (ExtendedProperty
value)
88 Insert (Count
, value);
91 public void AddRange (ExtendedProperty
[] value)
93 foreach (ExtendedProperty p
in value)
97 public void AddRange (ExtendedPropertyCollection
value)
99 foreach (ExtendedProperty p
in value)
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);
119 public void Insert (int index
, ExtendedProperty
value)
121 List
.Insert (index
, value);
122 qnames
[index
] = value.QualifiedName
;
126 protected override void OnInsert (int index
, object value)
131 protected override void OnRemove (int index
, object value)
136 public void Remove (ExtendedProperty
value)
138 int index
= IndexOf (value);
140 qnames
.RemoveAt (index
);
143 #endregion // Methods