1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle
.Core
.Configuration
18 using System
.Collections
;
21 /// A collection of <see cref="IConfiguration"/> objects.
24 public class ConfigurationCollection
: ReadOnlyCollectionBase
27 /// Creates a new instance of <c>ConfigurationCollection</c>.
29 public ConfigurationCollection()
34 /// Creates a new instance of <c>ConfigurationCollection</c>.
36 public ConfigurationCollection(ConfigurationCollection
value)
42 /// Creates a new instance of <c>ConfigurationCollection</c>.
44 public ConfigurationCollection(IConfiguration
[] value)
50 /// Represents the entry at the specified index of the <see cref="IConfiguration"/>.
52 /// <param name="index">
53 /// The zero-based index of the entry to locate in the collection.
56 /// The entry at the specified index of the collection.
58 /// <exception cref="System.ArgumentOutOfRangeException">
59 /// <paramref name="index"/> is outside the valid range of indexes for the collection.
61 public IConfiguration
this[int index
]
63 get { return (IConfiguration) InnerList[index]; }
64 set { InnerList[index] = value; }
67 public IConfiguration
this[String name
]
71 foreach(IConfiguration config
in InnerList
)
73 if (name
.Equals(config
.Name
))
84 /// Adds an <see cref="IConfiguration"/>.
86 /// <param name="value">The <see cref="IConfiguration"/> to add.</param>
88 /// The index at which the new element was inserted.
90 public IConfiguration
Add(IConfiguration
value)
97 /// Adds an array of <see cref="IConfiguration"/>.
99 /// <param name="value">The Array of <see cref="IConfiguration"/> to add.</param>
100 public void AddRange(IConfiguration
[] value)
102 foreach(IConfiguration configuration
in value)
109 /// Adds a <see cref="ConfigurationCollection"/>.
111 /// <param name="value">The <see cref="ConfigurationCollection"/> to add.</param>
112 public void AddRange(ConfigurationCollection
value)
114 foreach(IConfiguration configuration
in value)
121 /// Copies the elements to a one-dimensional <see cref="Array"/> instance at the specified index.
123 /// <param name="array">
124 /// The one-dimensional <see cref="Array"/> must have zero-based indexing.
126 /// <param name="index">The zero-based index in array at which copying begins.</param>
127 public void CopyTo(IConfiguration
[] array
, int index
)
129 InnerList
.CopyTo(array
, index
);
133 /// Gets a value indicating whether the <see cref="IConfiguration"/> contains
134 /// in the collection.
136 /// <param name="value">The <see cref="IConfiguration"/> to locate.</param>
138 /// <see langword="true"/> if the <see cref="IConfiguration"/> is contained in the collection;
139 /// otherwise, <see langword="false"/>.
141 public bool Contains(IConfiguration
value)
143 return InnerList
.Contains(value);
147 /// Removes a specific <see cref="IConfiguration"/> from the
150 /// <param name="value">The <see cref="IConfiguration"/> to remove from the collection.</param>
151 /// <exception cref="ArgumentException">
152 /// <paramref name="value"/> is not found in the collection.
154 public void Remove(IConfiguration
value)
156 InnerList
.Remove(value);