// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System;
using System.Collections;
-using System.Configuration.Provider;
namespace System.Configuration
{
public class SettingsPropertyCollection : ICloneable, ICollection, IEnumerable
{
+ Hashtable items;
+ bool isReadOnly;
+
public SettingsPropertyCollection ()
{
- throw new NotImplementedException ();
+ items = new Hashtable();
}
public void Add (SettingsProperty property)
{
- throw new NotImplementedException ();
+ if (isReadOnly)
+ throw new NotSupportedException ();
+
+ OnAdd (property);
+
+ /* actually do the add */
+ items.Add (property.Name, property);
+
+ OnAddComplete (property);
}
public void Clear ()
{
- throw new NotImplementedException ();
+ if (isReadOnly)
+ throw new NotSupportedException ();
+
+ OnClear ();
+
+ /* actually do the clear */
+ items.Clear ();
+
+ OnClearComplete();
}
public object Clone ()
{
- throw new NotImplementedException ();
+ SettingsPropertyCollection col = new SettingsPropertyCollection ();
+ col.items = (Hashtable)items.Clone ();
+
+ return col;
}
public void CopyTo (Array array, int index)
{
- throw new NotImplementedException ();
+ items.Values.CopyTo (array, index);
}
public IEnumerator GetEnumerator ()
{
- throw new NotImplementedException ();
+ return items.Values.GetEnumerator();
}
public void Remove (string name)
{
- throw new NotImplementedException ();
+ if (isReadOnly)
+ throw new NotSupportedException ();
+
+ SettingsProperty property = (SettingsProperty)items[name];
+
+ OnRemove (property);
+
+ /* actually do the remove */
+ items.Remove (name);
+
+ OnRemoveComplete (property);
}
public void SetReadOnly ()
{
- throw new NotImplementedException ();
+ isReadOnly = true;
}
- protected void OnAdd (SettingsProperty property)
+ protected virtual void OnAdd (SettingsProperty property)
{
}
- protected void OnAddComplete (SettingsProperty property)
+ protected virtual void OnAddComplete (SettingsProperty property)
{
}
- protected void OnClear ()
+ protected virtual void OnClear ()
{
}
- protected void OnClearComplete ()
+ protected virtual void OnClearComplete ()
{
}
- protected void OnRemove (SettingsProperty property)
+ protected virtual void OnRemove (SettingsProperty property)
{
}
- protected void OnRemoveComplete (SettingsProperty property)
+ protected virtual void OnRemoveComplete (SettingsProperty property)
{
}
public int Count {
get {
- throw new NotImplementedException ();
+ return items.Count;
}
}
public bool IsSynchronized {
- get {
- throw new NotImplementedException ();
- }
+ get { return false; }
}
public SettingsProperty this [ string name ] {
get {
- throw new NotImplementedException ();
+ return (SettingsProperty)items [name];
}
}
public object SyncRoot {
- get {
- throw new NotImplementedException ();
- }
+ get { return this; }
}
}
}
-#endif