New test.
[mono.git] / mcs / class / System / System.CodeDom / CodeCatchClauseCollection.cs
index cf23a4722125effa1086bfcd3519ba8c67337b39..05865d19577632c6bcf1c6ff45a582c8cfdf6c86 100644 (file)
@@ -5,8 +5,7 @@
 //   Miguel de Icaza (miguel@ximian.com)
 //
 // (C) 2001 Ximian, Inc.
-//
-
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -59,14 +58,14 @@ namespace System.CodeDom
                //
                // Properties
                //
-                public CodeCatchClause this[int index] {
-                        get {
-                                return (CodeCatchClause)List[index];
-                        }
+               public CodeCatchClause this[int index] {
+                       get {
+                               return (CodeCatchClause)List[index];
+                       }
                        set {
                                List[index] = value;
                        }
-                }
+               }
 
                //
                // Methods
@@ -78,14 +77,25 @@ namespace System.CodeDom
 
                public void AddRange (CodeCatchClause [] value)
                {
-                       foreach (CodeCatchClause ca in value) 
-                               Add (ca);
+                       if (value == null) {
+                               throw new ArgumentNullException ("value");
+                       }
+
+                       for (int i = 0; i < value.Length; i++) {
+                               Add (value[i]);
+                       }
                }
 
                public void AddRange (CodeCatchClauseCollection value )
                {
-                       foreach (CodeCatchClause ca in value)
-                               Add (ca);
+                       if (value == null) {
+                               throw new ArgumentNullException ("value");
+                       }
+
+                       int count = value.Count;
+                       for (int i = 0; i < count; i++) {
+                               Add (value[i]);
+                       }
                }
 
                public bool Contains( CodeCatchClause value )
@@ -110,10 +120,7 @@ namespace System.CodeDom
 
                public void Remove( CodeCatchClause value )
                {
-                       int index = IndexOf( value );
-                       if ( index < 0 )
-                               throw( new ArgumentException( "The specified object is not found in the collection" ) );
-                       RemoveAt( index );
+                       List.Remove (value);
                }
        }
 }