~ifolder-dev/simias/trunk-packaging

« back to all changes in this revision

Viewing changes to src/core/Simias.log4net/src/Util/.svn/text-base/PropertiesDictionary.cs.svn-base

  • Committer: Jorge O. Castro
  • Date: 2007-12-03 06:56:46 UTC
  • Revision ID: jorge@ubuntu.com-20071203065646-mupcnjcwgm5mnhyt
* Remove a bunch of .svn directories we no longer need.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#region Copyright & License
2
 
//
3
 
// Copyright 2001-2005 The Apache Software Foundation
4
 
//
5
 
// Licensed under the Apache License, Version 2.0 (the "License");
6
 
// you may not use this file except in compliance with the License.
7
 
// You may obtain a copy of the License at
8
 
//
9
 
// http://www.apache.org/licenses/LICENSE-2.0
10
 
//
11
 
// Unless required by applicable law or agreed to in writing, software
12
 
// distributed under the License is distributed on an "AS IS" BASIS,
13
 
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 
// See the License for the specific language governing permissions and
15
 
// limitations under the License.
16
 
//
17
 
#endregion
18
 
 
19
 
using System;
20
 
using System.Collections;
21
 
#if !NETCF
22
 
using System.Runtime.Serialization;
23
 
using System.Xml;
24
 
#endif
25
 
 
26
 
namespace log4net.Util
27
 
{
28
 
        /// <summary>
29
 
        /// String keyed object map.
30
 
        /// </summary>
31
 
        /// <remarks>
32
 
        /// <para>
33
 
        /// While this collection is serializable only member 
34
 
        /// objects that are serializable will
35
 
        /// be serialized along with this collection.
36
 
        /// </para>
37
 
        /// </remarks>
38
 
        /// <author>Nicko Cadell</author>
39
 
        /// <author>Gert Driesen</author>
40
 
#if NETCF
41
 
        public sealed class PropertiesDictionary : ReadOnlyPropertiesDictionary, IDictionary
42
 
#else
43
 
        [Serializable] public sealed class PropertiesDictionary : ReadOnlyPropertiesDictionary, ISerializable, IDictionary
44
 
#endif
45
 
        {
46
 
                #region Public Instance Constructors
47
 
 
48
 
                /// <summary>
49
 
                /// Constructor
50
 
                /// </summary>
51
 
                /// <remarks>
52
 
                /// <para>
53
 
                /// Initializes a new instance of the <see cref="PropertiesDictionary" /> class.
54
 
                /// </para>
55
 
                /// </remarks>
56
 
                public PropertiesDictionary()
57
 
                {
58
 
                }
59
 
 
60
 
                /// <summary>
61
 
                /// Constructor
62
 
                /// </summary>
63
 
                /// <param name="propertiesDictionary">properties to copy</param>
64
 
                /// <remarks>
65
 
                /// <para>
66
 
                /// Initializes a new instance of the <see cref="PropertiesDictionary" /> class.
67
 
                /// </para>
68
 
                /// </remarks>
69
 
                public PropertiesDictionary(ReadOnlyPropertiesDictionary propertiesDictionary) : base(propertiesDictionary)
70
 
                {
71
 
                }
72
 
 
73
 
                #endregion Public Instance Constructors
74
 
 
75
 
                #region Private Instance Constructors
76
 
 
77
 
#if !NETCF
78
 
                /// <summary>
79
 
                /// Initializes a new instance of the <see cref="PropertiesDictionary" /> class 
80
 
                /// with serialized data.
81
 
                /// </summary>
82
 
                /// <param name="info">The <see cref="SerializationInfo" /> that holds the serialized object data.</param>
83
 
                /// <param name="context">The <see cref="StreamingContext" /> that contains contextual information about the source or destination.</param>
84
 
                /// <remarks>
85
 
                /// <para>
86
 
                /// Because this class is sealed the serialization constructor is private.
87
 
                /// </para>
88
 
                /// </remarks>
89
 
                private PropertiesDictionary(SerializationInfo info, StreamingContext context) : base(info, context)
90
 
                {
91
 
                }
92
 
#endif
93
 
 
94
 
                #endregion Protected Instance Constructors
95
 
 
96
 
                #region Public Instance Properties
97
 
 
98
 
                /// <summary>
99
 
                /// Gets or sets the value of the  property with the specified key.
100
 
                /// </summary>
101
 
                /// <value>
102
 
                /// The value of the property with the specified key.
103
 
                /// </value>
104
 
                /// <param name="key">The key of the property to get or set.</param>
105
 
                /// <remarks>
106
 
                /// <para>
107
 
                /// The property value will only be serialized if it is serializable.
108
 
                /// If it cannot be serialized it will be silently ignored if
109
 
                /// a serialization operation is performed.
110
 
                /// </para>
111
 
                /// </remarks>
112
 
                override public object this[string key]
113
 
                {
114
 
                        get { return InnerHashtable[key]; }
115
 
                        set { InnerHashtable[key] = value; }
116
 
                }
117
 
 
118
 
                #endregion Public Instance Properties
119
 
 
120
 
                #region Public Instance Methods
121
 
 
122
 
                /// <summary>
123
 
                /// Remove the entry with the specified key from this dictionary
124
 
                /// </summary>
125
 
                /// <param name="key">the key for the entry to remove</param>
126
 
                /// <remarks>
127
 
                /// <para>
128
 
                /// Remove the entry with the specified key from this dictionary
129
 
                /// </para>
130
 
                /// </remarks>
131
 
                public void Remove(string key)
132
 
                {
133
 
                        InnerHashtable.Remove(key);
134
 
                }
135
 
 
136
 
                #endregion Public Instance Methods
137
 
 
138
 
                #region Implementation of IDictionary
139
 
 
140
 
                /// <summary>
141
 
                /// See <see cref="IDictionary.GetEnumerator"/>
142
 
                /// </summary>
143
 
                /// <returns>an enumerator</returns>
144
 
                /// <remarks>
145
 
                /// <para>
146
 
                /// Returns a <see cref="IDictionaryEnumerator"/> over the contest of this collection.
147
 
                /// </para>
148
 
                /// </remarks>
149
 
                IDictionaryEnumerator IDictionary.GetEnumerator()
150
 
                {
151
 
                        return InnerHashtable.GetEnumerator();
152
 
                }
153
 
 
154
 
                /// <summary>
155
 
                /// See <see cref="IDictionary.Remove"/>
156
 
                /// </summary>
157
 
                /// <param name="key">the key to remove</param>
158
 
                /// <remarks>
159
 
                /// <para>
160
 
                /// Remove the entry with the specified key from this dictionary
161
 
                /// </para>
162
 
                /// </remarks>
163
 
                void IDictionary.Remove(object key)
164
 
                {
165
 
                        InnerHashtable.Remove(key);
166
 
                }
167
 
 
168
 
                /// <summary>
169
 
                /// See <see cref="IDictionary.Contains"/>
170
 
                /// </summary>
171
 
                /// <param name="key">the key to lookup in the collection</param>
172
 
                /// <returns><c>true</c> if the collection contains the specified key</returns>
173
 
                /// <remarks>
174
 
                /// <para>
175
 
                /// Test if this collection contains a specified key.
176
 
                /// </para>
177
 
                /// </remarks>
178
 
                bool IDictionary.Contains(object key)
179
 
                {
180
 
                        return InnerHashtable.Contains(key);
181
 
                }
182
 
 
183
 
                /// <summary>
184
 
                /// Remove all properties from the properties collection
185
 
                /// </summary>
186
 
                /// <remarks>
187
 
                /// <para>
188
 
                /// Remove all properties from the properties collection
189
 
                /// </para>
190
 
                /// </remarks>
191
 
                public override void Clear()
192
 
                {
193
 
                        InnerHashtable.Clear();
194
 
                }
195
 
 
196
 
                /// <summary>
197
 
                /// See <see cref="IDictionary.Add"/>
198
 
                /// </summary>
199
 
                /// <param name="key">the key</param>
200
 
                /// <param name="value">the value to store for the key</param>
201
 
                /// <remarks>
202
 
                /// <para>
203
 
                /// Store a value for the specified <see cref="String"/> <paramref name="key"/>.
204
 
                /// </para>
205
 
                /// </remarks>
206
 
                /// <exception cref="ArgumentException">Thrown if the <paramref name="key"/> is not a string</exception>
207
 
                void IDictionary.Add(object key, object value)
208
 
                {
209
 
                        if (!(key is string))
210
 
                        {
211
 
                                throw new ArgumentException("key must be a string", "key");
212
 
                        }
213
 
                        InnerHashtable.Add(key, value);
214
 
                }
215
 
 
216
 
                /// <summary>
217
 
                /// See <see cref="IDictionary.IsReadOnly"/>
218
 
                /// </summary>
219
 
                /// <value>
220
 
                /// <c>false</c>
221
 
                /// </value>
222
 
                /// <remarks>
223
 
                /// <para>
224
 
                /// This collection is modifiable. This property always
225
 
                /// returns <c>false</c>.
226
 
                /// </para>
227
 
                /// </remarks>
228
 
                bool IDictionary.IsReadOnly
229
 
                {
230
 
                        get { return false; }
231
 
                }
232
 
 
233
 
                /// <summary>
234
 
                /// See <see cref="IDictionary.this"/>
235
 
                /// </summary>
236
 
                /// <value>
237
 
                /// The value for the key specified.
238
 
                /// </value>
239
 
                /// <remarks>
240
 
                /// <para>
241
 
                /// Get or set a value for the specified <see cref="String"/> <paramref name="key"/>.
242
 
                /// </para>
243
 
                /// </remarks>
244
 
                /// <exception cref="ArgumentException">Thrown if the <paramref name="key"/> is not a string</exception>
245
 
                object IDictionary.this[object key]
246
 
                {
247
 
                        get
248
 
                        {
249
 
                                if (!(key is string))
250
 
                                {
251
 
                                        throw new ArgumentException("key must be a string", "key");
252
 
                                }
253
 
                                return InnerHashtable[key];
254
 
                        }
255
 
                        set
256
 
                        {
257
 
                                if (!(key is string))
258
 
                                {
259
 
                                        throw new ArgumentException("key must be a string", "key");
260
 
                                }
261
 
                                InnerHashtable[key] = value;
262
 
                        }
263
 
                }
264
 
 
265
 
                /// <summary>
266
 
                /// See <see cref="IDictionary.Values"/>
267
 
                /// </summary>
268
 
                ICollection IDictionary.Values
269
 
                {
270
 
                        get { return InnerHashtable.Values; }
271
 
                }
272
 
 
273
 
                /// <summary>
274
 
                /// See <see cref="IDictionary.Keys"/>
275
 
                /// </summary>
276
 
                ICollection IDictionary.Keys
277
 
                {
278
 
                        get { return InnerHashtable.Keys; }
279
 
                }
280
 
 
281
 
                /// <summary>
282
 
                /// See <see cref="IDictionary.IsFixedSize"/>
283
 
                /// </summary>
284
 
                bool IDictionary.IsFixedSize
285
 
                {
286
 
                        get { return false; }
287
 
                }
288
 
 
289
 
                #endregion
290
 
 
291
 
                #region Implementation of ICollection
292
 
 
293
 
                /// <summary>
294
 
                /// See <see cref="ICollection.CopyTo"/>
295
 
                /// </summary>
296
 
                /// <param name="array"></param>
297
 
                /// <param name="index"></param>
298
 
                void ICollection.CopyTo(Array array, int index)
299
 
                {
300
 
                        InnerHashtable.CopyTo(array, index);
301
 
                }
302
 
 
303
 
                /// <summary>
304
 
                /// See <see cref="ICollection.IsSynchronized"/>
305
 
                /// </summary>
306
 
                bool ICollection.IsSynchronized
307
 
                {
308
 
                        get { return InnerHashtable.IsSynchronized; }
309
 
                }
310
 
 
311
 
                /// <summary>
312
 
                /// See <see cref="ICollection.SyncRoot"/>
313
 
                /// </summary>
314
 
                object ICollection.SyncRoot
315
 
                {
316
 
                        get { return InnerHashtable.SyncRoot; }
317
 
                }
318
 
 
319
 
                #endregion
320
 
 
321
 
                #region Implementation of IEnumerable
322
 
 
323
 
                /// <summary>
324
 
                /// See <see cref="IEnumerable.GetEnumerator"/>
325
 
                /// </summary>
326
 
                IEnumerator IEnumerable.GetEnumerator()
327
 
                {
328
 
                        return ((IEnumerable)InnerHashtable).GetEnumerator();
329
 
                }
330
 
 
331
 
                #endregion
332
 
        }
333
 
}
334