**** Merged from MCS ****
[mono-project.git] / mcs / class / System.Configuration.Install / System.Configuration.Install / InstallerCollection.cs
blob9d8b2c1ca6e0ed7b3062190c17ab72dcc110a231
1 // System.Configuration.Install.Installer.cs
2 //
3 // Author:
4 // Alejandro Sánchez Acosta <raciel@es.gnu.org>
5 //
6 // (C) Alejandro Sánchez Acosta
7 //
9 //
10 // Permission is hereby granted, free of charge, to any person obtaining
11 // a copy of this software and associated documentation files (the
12 // "Software"), to deal in the Software without restriction, including
13 // without limitation the rights to use, copy, modify, merge, publish,
14 // distribute, sublicense, and/or sell copies of the Software, and to
15 // permit persons to whom the Software is furnished to do so, subject to
16 // the following conditions:
17 //
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
20 //
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 using System.Collections;
32 namespace System.Configuration.Install
34 public class InstallerCollection : CollectionBase
36 #region Constructors
38 internal InstallerCollection(Installer owner)
40 this.owner = owner;
43 #endregion Constructors
46 public Installer this[int index] {
47 get
49 return (Installer) base.List[index];
51 set
53 base.List[index] = value;
57 public int Add (Installer value) {
58 return base.List.Add (value);
61 public void AddRange (Installer[] value) {
62 if (value == null)
64 throw new ArgumentNullException ("value");
67 for (int counter = 0; counter < value.Length; counter++)
69 Add (value[counter]);
73 public void AddRange (InstallerCollection value) {
74 if (value == null)
76 throw new ArgumentNullException ("value");
79 int itemCount = value.Count;
80 for (int counter = 0; counter < itemCount; counter++)
82 Add (value[counter]);
86 public bool Contains (Installer value) {
87 return base.List.Contains (value);
90 public void CopyTo (Installer[] array, int index) {
91 base.List.CopyTo (array, index);
94 public int IndexOf (Installer value) {
95 return base.List.IndexOf (value);
98 public void Insert (int index, Installer value) {
99 base.List.Insert (index, value);
102 protected override void OnInsert (int index, object value) {
103 ((Installer) value).parent = owner;
106 protected override void OnRemove (int index, object value) {
107 ((Installer) value).parent = null;
110 protected override void OnSet (int index, object oldValue, object newValue) {
111 ((Installer) oldValue).parent = null;
112 ((Installer) newValue).parent = owner;
115 public void Remove (Installer value) {
116 base.List.Remove(value);
119 #region Private Instance Fields
121 private Installer owner;
123 #endregion Private Instance Fields