2 // System.Web.Services.Description.ServiceDescriptionBaseCollection.cs
\r
5 // Tim Coleman (tim@timcoleman.com)
\r
7 // Copyright (C) Tim Coleman, 2002
\r
10 using System.Collections;
\r
11 using System.Web.Services;
\r
13 namespace System.Web.Services.Description {
\r
14 public abstract class ServiceDescriptionBaseCollection : CollectionBase {
\r
18 Hashtable table = new Hashtable ();
\r
21 #endregion // Fields
\r
23 #region Constructors
\r
25 internal ServiceDescriptionBaseCollection (object parent)
\r
27 this.parent = parent;
\r
30 #endregion // Constructors
\r
34 protected virtual IDictionary Table {
\r
35 get { return table; }
\r
38 #endregion // Properties
\r
42 protected virtual string GetKey (object value)
\r
47 protected override void OnClear ()
\r
52 protected override void OnInsertComplete (int index, object value)
\r
54 if (GetKey (value) != null)
\r
55 Table [GetKey (value)] = value;
\r
56 SetParent (value, parent);
\r
59 protected override void OnRemove (int index, object value)
\r
61 if (GetKey (value) != null)
\r
62 Table.Remove (GetKey (value));
\r
65 protected override void OnSet (int index, object oldValue, object newValue)
\r
67 if (GetKey (oldValue) != null)
\r
68 Table.Remove (GetKey (oldValue));
\r
69 if (GetKey (newValue) != null)
\r
70 Table [GetKey (newValue)] = newValue;
\r
71 SetParent (newValue, parent);
\r
74 protected virtual void SetParent (object value, object parent)
\r
78 #endregion // Methods
\r