Fixing an issue with output parameters that are of type IntPtr
[castle.git] / Core / Castle.Core / Model / ParameterModelCollection.cs
blob69eec7df92149674433437251f7be9498c935c90
1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
2 //
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
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
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
17 using System;
18 using System.Collections;
19 using Castle.Core.Configuration;
20 using System.Collections.Generic;
22 /// <summary>
23 /// Collection of <see cref="ParameterModel"/>
24 /// </summary>
25 #if !SILVERLIGHT
26 [Serializable]
27 #endif
28 public class ParameterModelCollection : IEnumerable
30 private IDictionary<string, ParameterModel> dictionary;
31 private readonly object syncRoot = new object();
33 /// <summary>
34 /// Initializes a new instance of the <see cref="ParameterModelCollection"/> class.
35 /// </summary>
36 public ParameterModelCollection()
38 dictionary = new Dictionary<string, ParameterModel>(StringComparer.InvariantCultureIgnoreCase);
41 /// <summary>
42 /// Adds the specified name.
43 /// </summary>
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));
51 /// <summary>
52 /// Adds the specified name.
53 /// </summary>
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));
61 /// <summary>
62 /// Determines whether this collection contains the specified key.
63 /// </summary>
64 /// <param name="key">The key.</param>
65 /// <returns>
66 /// <c>true</c> if yes; otherwise, <c>false</c>.
67 /// </returns>
68 public bool Contains(object key)
70 return dictionary.ContainsKey((string) key);
73 /// <summary>
74 /// Adds the specified key.
75 /// </summary>
76 /// <remarks>
77 /// Not implemented
78 /// </remarks>
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();
86 /// <summary>
87 /// Clears this instance.
88 /// </summary>
89 /// <remarks>
90 /// Not implemented
91 /// </remarks>
92 public void Clear()
94 throw new NotImplementedException();
97 /// <summary>
98 /// Removes the specified key.
99 /// </summary>
100 /// <param name="key">The key.</param>
101 /// <remarks>
102 /// Not implemented
103 /// </remarks>
104 public void Remove(object key)
106 throw new NotImplementedException();
109 /// <summary>
110 /// Gets the keys.
111 /// </summary>
112 /// <value>The keys.</value>
113 /// <remarks>
114 /// Not implemented
115 /// </remarks>
116 public ICollection Keys
118 get { throw new NotImplementedException(); }
121 /// <summary>
122 /// Gets the values.
123 /// </summary>
124 /// <value>The values.</value>
125 /// <remarks>
126 /// Not implemented
127 /// </remarks>
128 public ICollection Values
130 get { throw new NotImplementedException(); }
133 /// <summary>
134 /// Gets a value indicating whether this instance is read only.
135 /// </summary>
136 /// <value>
137 /// <c>true</c> if this instance is read only; otherwise, <c>false</c>.
138 /// </value>
139 public bool IsReadOnly
141 get { return dictionary.IsReadOnly; }
144 /// <summary>
145 /// Gets a value indicating whether this instance is fixed size.
146 /// </summary>
147 /// <value>
148 /// <c>true</c> if this instance is fixed size; otherwise, <c>false</c>.
149 /// </value>
150 public bool IsFixedSize
152 get { return false; }
155 /// <summary>
156 /// Gets the <see cref="ParameterModel"/> with the specified key.
157 /// </summary>
158 /// <value></value>
159 public ParameterModel this[object key]
163 ParameterModel result;
164 dictionary.TryGetValue((string) key, out result);
165 return result;
169 /// <summary>
170 /// Copy the content to the specified array
171 /// </summary>
172 /// <param name="array">target array</param>
173 /// <param name="index">target index</param>
174 /// <remarks>
175 /// Not implemented
176 /// </remarks>
177 public void CopyTo(Array array, int index)
179 throw new NotImplementedException();
182 /// <summary>
183 /// Gets the count.
184 /// </summary>
185 /// <value>The count.</value>
186 public int Count
188 get { return dictionary.Count; }
191 /// <summary>
192 /// Gets the sync root.
193 /// </summary>
194 /// <value>The sync root.</value>
195 public object SyncRoot
197 get { return syncRoot; }
200 /// <summary>
201 /// Gets a value indicating whether this instance is synchronized.
202 /// </summary>
203 /// <value>
204 /// <c>true</c> if this instance is synchronized; otherwise, <c>false</c>.
205 /// </value>
206 public bool IsSynchronized
208 get { return false; }
211 /// <summary>
212 /// Returns an enumerator that can iterate through a collection.
213 /// </summary>
214 /// <returns>
215 /// An <see cref="T:System.Collections.IEnumerator"/>
216 /// that can be used to iterate through the collection.
217 /// </returns>
218 public IEnumerator GetEnumerator()
220 return dictionary.Values.GetEnumerator();