Merge pull request #1709 from atsushieno/import-codedom-core
[mono.git] / mcs / class / System / System.CodeDom / CodeCommentStatementCollection.cs
index 5db5ac0c45ac34efed8e1b15e55c8af9a2c43568..38f83ce2d694eb934ce1ccf6c3c7f03dc25b6960 100644 (file)
@@ -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 (CodeCommentStatement [] value )
                {
-                       foreach ( CodeCommentStatement 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 (CodeCommentStatementCollection value)
                {
-                       foreach ( CodeCommentStatement 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( CodeCommentStatement value )
@@ -112,10 +122,7 @@ namespace System.CodeDom
 
                public void Remove( CodeCommentStatement 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);
                }
        }
 }