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.
18 using System
.Collections
;
19 using Castle
.Core
.Configuration
;
20 using System
.Collections
.Generic
;
23 /// Collection of <see cref="ParameterModel"/>
28 public class ParameterModelCollection
: IEnumerable
30 private IDictionary
<string, ParameterModel
> dictionary
;
31 private readonly object syncRoot
= new object();
34 /// Initializes a new instance of the <see cref="ParameterModelCollection"/> class.
36 public ParameterModelCollection()
38 dictionary
= new Dictionary
<string, ParameterModel
>(StringComparer
.InvariantCultureIgnoreCase
);
42 /// Adds the specified name.
44 /// <param name="name">The name.</param>
45 /// <param name="value">The value.</param>
46 public void Add(String name
, String
value)
48 dictionary
.Add(name
, new ParameterModel(name
, value));
52 /// Adds the specified name.
54 /// <param name="name">The name.</param>
55 /// <param name="configNode">The config node.</param>
56 public void Add(String name
, IConfiguration configNode
)
58 dictionary
.Add(name
, new ParameterModel(name
, configNode
));
62 /// Determines whether this collection contains the specified key.
64 /// <param name="key">The key.</param>
66 /// <c>true</c> if yes; otherwise, <c>false</c>.
68 public bool Contains(object key
)
70 return dictionary
.ContainsKey((string) key
);
74 /// Adds the specified key.
79 /// <param name="key">The key.</param>
80 /// <param name="value">The value.</param>
81 public void Add(object key
, object value)
83 throw new NotImplementedException();
87 /// Clears this instance.
94 throw new NotImplementedException();
98 /// Removes the specified key.
100 /// <param name="key">The key.</param>
104 public void Remove(object key
)
106 throw new NotImplementedException();
112 /// <value>The keys.</value>
116 public ICollection Keys
118 get { throw new NotImplementedException(); }
124 /// <value>The values.</value>
128 public ICollection Values
130 get { throw new NotImplementedException(); }
134 /// Gets a value indicating whether this instance is read only.
137 /// <c>true</c> if this instance is read only; otherwise, <c>false</c>.
139 public bool IsReadOnly
141 get { return dictionary.IsReadOnly; }
145 /// Gets a value indicating whether this instance is fixed size.
148 /// <c>true</c> if this instance is fixed size; otherwise, <c>false</c>.
150 public bool IsFixedSize
152 get { return false; }
156 /// Gets the <see cref="ParameterModel"/> with the specified key.
159 public ParameterModel
this[object key
]
163 ParameterModel result
;
164 dictionary
.TryGetValue((string) key
, out result
);
170 /// Copy the content to the specified array
172 /// <param name="array">target array</param>
173 /// <param name="index">target index</param>
177 public void CopyTo(Array array
, int index
)
179 throw new NotImplementedException();
185 /// <value>The count.</value>
188 get { return dictionary.Count; }
192 /// Gets the sync root.
194 /// <value>The sync root.</value>
195 public object SyncRoot
197 get { return syncRoot; }
201 /// Gets a value indicating whether this instance is synchronized.
204 /// <c>true</c> if this instance is synchronized; otherwise, <c>false</c>.
206 public bool IsSynchronized
208 get { return false; }
212 /// Returns an enumerator that can iterate through a collection.
215 /// An <see cref="T:System.Collections.IEnumerator"/>
216 /// that can be used to iterate through the collection.
218 public IEnumerator
GetEnumerator()
220 return dictionary
.Values
.GetEnumerator();