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
.Components
.DictionaryAdapter
18 using System
.Collections
;
21 /// Abstract adapter for the <see cref="IDictionary"/> support
22 /// needed by the <see cref="DictionaryAdapterFactory"/>
24 public abstract class AbstractDictionaryAdapter
: IDictionary
27 /// Adds an element with the provided key and value to the <see cref="T:System.Collections.IDictionary"></see> object.
29 /// <param name="key">The <see cref="T:System.Object"></see> to use as the key of the element to add.</param>
30 /// <param name="value">The <see cref="T:System.Object"></see> to use as the value of the element to add.</param>
31 /// <exception cref="T:System.ArgumentException">An element with the same key already exists in the <see cref="T:System.Collections.IDictionary"></see> object. </exception>
32 /// <exception cref="T:System.ArgumentNullException">key is null. </exception>
33 /// <exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.IDictionary"></see> is read-only.-or- The <see cref="T:System.Collections.IDictionary"></see> has a fixed size. </exception>
34 public void Add(object key
, object value)
36 throw new NotSupportedException();
40 /// Removes all elements from the <see cref="T:System.Collections.IDictionary"></see> object.
42 /// <exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.IDictionary"></see> object is read-only. </exception>
45 throw new NotSupportedException();
49 /// Determines whether the <see cref="T:System.Collections.IDictionary"></see> object contains an element with the specified key.
51 /// <param name="key">The key to locate in the <see cref="T:System.Collections.IDictionary"></see> object.</param>
53 /// true if the <see cref="T:System.Collections.IDictionary"></see> contains an element with the key; otherwise, false.
55 /// <exception cref="T:System.ArgumentNullException">key is null. </exception>
56 public abstract bool Contains(object key
);
59 /// Returns an <see cref="T:System.Collections.IDictionaryEnumerator"></see> object for the <see cref="T:System.Collections.IDictionary"></see> object.
62 /// An <see cref="T:System.Collections.IDictionaryEnumerator"></see> object for the <see cref="T:System.Collections.IDictionary"></see> object.
64 public IDictionaryEnumerator
GetEnumerator()
66 throw new NotSupportedException();
70 /// Gets a value indicating whether the <see cref="T:System.Collections.IDictionary"></see> object has a fixed size.
73 /// <returns>true if the <see cref="T:System.Collections.IDictionary"></see> object has a fixed size; otherwise, false.</returns>
74 public bool IsFixedSize
76 get { throw new NotSupportedException(); }
80 /// Gets a value indicating whether the <see cref="T:System.Collections.IDictionary"></see> object is read-only.
83 /// <returns>true if the <see cref="T:System.Collections.IDictionary"></see> object is read-only; otherwise, false.</returns>
84 public abstract bool IsReadOnly { get; }
87 /// Gets an <see cref="T:System.Collections.ICollection"></see> object containing the keys of the <see cref="T:System.Collections.IDictionary"></see> object.
90 /// <returns>An <see cref="T:System.Collections.ICollection"></see> object containing the keys of the <see cref="T:System.Collections.IDictionary"></see> object.</returns>
91 public ICollection Keys
93 get { throw new NotSupportedException(); }
97 /// Removes the element with the specified key from the <see cref="T:System.Collections.IDictionary"></see> object.
99 /// <param name="key">The key of the element to remove.</param>
100 /// <exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.IDictionary"></see> object is read-only.-or- The <see cref="T:System.Collections.IDictionary"></see> has a fixed size. </exception>
101 /// <exception cref="T:System.ArgumentNullException">key is null. </exception>
102 public void Remove(object key
)
104 throw new NotSupportedException();
108 /// Gets an <see cref="T:System.Collections.ICollection"></see> object containing the values in the <see cref="T:System.Collections.IDictionary"></see> object.
111 /// <returns>An <see cref="T:System.Collections.ICollection"></see> object containing the values in the <see cref="T:System.Collections.IDictionary"></see> object.</returns>
112 public ICollection Values
114 get { throw new NotSupportedException(); }
118 /// Gets or sets the <see cref="System.Object"/> with the specified key.
121 public abstract object this[object key
] { get; set; }
124 /// Copies the elements of the <see cref="T:System.Collections.ICollection"></see> to an <see cref="T:System.Array"></see>, starting at a particular <see cref="T:System.Array"></see> index.
126 /// <param name="array">The one-dimensional <see cref="T:System.Array"></see> that is the destination of the elements copied from <see cref="T:System.Collections.ICollection"></see>. The <see cref="T:System.Array"></see> must have zero-based indexing.</param>
127 /// <param name="index">The zero-based index in array at which copying begins.</param>
128 /// <exception cref="T:System.ArgumentNullException">array is null. </exception>
129 /// <exception cref="T:System.ArgumentException">The type of the source <see cref="T:System.Collections.ICollection"></see> cannot be cast automatically to the type of the destination array. </exception>
130 /// <exception cref="T:System.ArgumentOutOfRangeException">index is less than zero. </exception>
131 /// <exception cref="T:System.ArgumentException">array is multidimensional.-or- index is equal to or greater than the length of array.-or- The number of elements in the source <see cref="T:System.Collections.ICollection"></see> is greater than the available space from index to the end of the destination array. </exception>
132 public void CopyTo(Array array
, int index
)
134 throw new NotSupportedException();
138 /// Gets the number of elements contained in the <see cref="T:System.Collections.ICollection"></see>.
141 /// <returns>The number of elements contained in the <see cref="T:System.Collections.ICollection"></see>.</returns>
144 get { throw new NotSupportedException(); }
148 /// Gets a value indicating whether access to the <see cref="T:System.Collections.ICollection"></see> is synchronized (thread safe).
151 /// <returns>true if access to the <see cref="T:System.Collections.ICollection"></see> is synchronized (thread safe); otherwise, false.</returns>
152 public virtual bool IsSynchronized
154 get { return false; }
158 /// Gets an object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection"></see>.
161 /// <returns>An object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection"></see>.</returns>
162 public virtual object SyncRoot
168 /// Returns an enumerator that iterates through a collection.
171 /// An <see cref="T:System.Collections.IEnumerator"></see> object that can be used to iterate through the collection.
173 IEnumerator IEnumerable
.GetEnumerator()
175 throw new NotSupportedException();