Fix problems with overlong directory names: phase #1
[mono.git] / mcs / class / System / System.CodeDom / CodeTypeReferenceCollection.cs
index dc14aa714ee8244b0e03510cb95fbfd3550687e3..0212e4e1f6845b2f5a877b8f7563f86546786dac 100644 (file)
@@ -103,7 +103,8 @@ namespace System.CodeDom
                                throw new ArgumentNullException ("value");
                        }
 
-                       for (int i = 0; i < value.Count; i++) {
+                       int count = value.Count;
+                       for (int i = 0; i < count; i++) {
                                Add (value[i]);
                        }
                }
@@ -130,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);
                }
        }
 }