Fix problems with overlong directory names: phase #1
[mono.git] / mcs / class / System / System.CodeDom / CodeTypeReferenceCollection.cs
index 7d9c2e92e17db43f79e940d532496ee91bdca498..0212e4e1f6845b2f5a877b8f7563f86546786dac 100644 (file)
@@ -5,8 +5,7 @@
 //   Daniel Stodden (stodden@in.tum.de)
 //
 // (C) 2002 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
@@ -89,14 +88,25 @@ namespace System.CodeDom
 
                public void AddRange (CodeTypeReference [] value )
                {
-                       foreach ( CodeTypeReference 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 (CodeTypeReferenceCollection value)
                {
-                       foreach ( CodeTypeReference 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( CodeTypeReference value )
@@ -121,10 +131,7 @@ namespace System.CodeDom
 
                public void Remove( CodeTypeReference 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);
                }
        }
 }