Implemented a few missing properties
[mono.git] / mcs / class / System.Web / System.Web.UI / ControlCollection.cs
index d6b340bd700f6073da5b374e8f7faca2b27a3ff9..13264b4341661747c31f961f8273361979d86dae 100644 (file)
@@ -51,7 +51,11 @@ namespace System.Web.UI {
                        this.owner = owner;
                }
 
-               public int Count {
+               public
+#if NET_2_0
+               virtual
+#endif
+               int Count {
                        get { return count; }
                }
 
@@ -95,7 +99,7 @@ namespace System.Web.UI {
                public virtual void Add (Control child)
                {
                        if (child == null)
-                               throw new ArgumentNullException ();
+                               throw new ArgumentNullException ("child");
 
                        if (readOnly)
                                throw new HttpException (Locale.GetText ("Collection is read-only."));
@@ -155,7 +159,11 @@ namespace System.Web.UI {
                        return (controls != null && Array.IndexOf (controls, c) != -1);
                }
 
-               public void CopyTo (Array array, int index)
+               public
+#if NET_2_0
+               virtual
+#endif
+               void CopyTo (Array array, int index)
                {
                        if (controls == null)
                                return;
@@ -175,17 +183,21 @@ namespace System.Web.UI {
                                throw new ArgumentOutOfRangeException ("index", Locale.GetText ("Value has to be >= 0."));
 
                        for (int i=0; i < count; i++)
-                               array.SetValue (controls [i], i);
+                               array.SetValue (controls [i], i + index);
                }
 
-               public IEnumerator GetEnumerator ()
+               public
+#if NET_2_0
+               virtual
+#endif
+               IEnumerator GetEnumerator ()
                {
                        return new SimpleEnumerator (this);
                }
 
                public virtual int IndexOf (Control c)
                {
-                       if (controls == null)
+                       if (controls == null || c == null)
                                return -1;
 
                        return Array.IndexOf (controls, c);