New test.
[mono.git] / mcs / class / System / System.CodeDom / CodeAttributeDeclarationCollection.cs
old mode 100755 (executable)
new mode 100644 (file)
index de4b6a9..48e8801
@@ -6,8 +6,7 @@
 //   Daniel Stodden (stodden@in.tum.de)
 //
 // (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
@@ -80,14 +79,25 @@ namespace System.CodeDom
 
                public void AddRange (CodeAttributeDeclaration [] value)
                {
-                       foreach (CodeAttributeDeclaration elem in value) 
-                               Add( elem );
+                       if (value == null) {
+                               throw new ArgumentNullException ("value");
+                       }
+
+                       for (int i = 0; i < value.Length; i++) {
+                               Add (value[i]);
+                       }
                }
 
                public void AddRange (CodeAttributeDeclarationCollection value)
                {
-                       foreach (CodeAttributeDeclaration elem in value) 
-                               Add( elem );
+                       if (value == null) {
+                               throw new ArgumentNullException ("value");
+                       }
+
+                       int count = value.Count;
+                       for (int i = 0; i < count; i++) {
+                               Add (value[i]);
+                       }
                }
 
                public bool Contains( CodeAttributeDeclaration value )
@@ -112,10 +122,7 @@ namespace System.CodeDom
 
                public void Remove( CodeAttributeDeclaration 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);
                }
        }
 }