Use 3-arg Array.Copy in ImmutableArray.CopyTo (#32387)
authorMarius Ungureanu <therzok@gmail.com>
Mon, 13 Apr 2020 16:22:28 +0000 (19:22 +0300)
committerGitHub <noreply@github.com>
Mon, 13 Apr 2020 16:22:28 +0000 (12:22 -0400)
src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Minimal.cs
src/libraries/System.Collections.Immutable/tests/ImmutableArrayTest.cs

index 6a7695d..6d0e50f 100644 (file)
@@ -232,7 +232,7 @@ namespace System.Collections.Immutable
         {
             var self = this;
             self.ThrowNullRefIfNotInitialized();
-            Array.Copy(self.array!, 0, destination, 0, self.Length);
+            Array.Copy(self.array!, destination, self.Length);
         }
 
         /// <summary>
index 192b779..0e1a25a 100644 (file)
@@ -1631,7 +1631,7 @@ namespace System.Collections.Immutable.Tests
             // ImmutableArray<T>.CopyTo defers to Array.Copy for argument validation, so
             // the parameter names here come from Array.Copy.
 
-            AssertExtensions.Throws<ArgumentNullException>("destinationArray", "dest", () => array.CopyTo(null));
+            AssertExtensions.Throws<ArgumentNullException>("destinationArray", () => array.CopyTo(null));
             AssertExtensions.Throws<ArgumentNullException>("destinationArray", "dest", () => array.CopyTo(null, 0));
             AssertExtensions.Throws<ArgumentNullException>("destinationArray", "dest", () => array.CopyTo(0, null, 0, 0));
             AssertExtensions.Throws<ArgumentNullException>("destinationArray", "dest", () => array.CopyTo(-1, null, -1, -1)); // The destination should be validated first.