From f0ede00a8702d27fa6d49d7cb94ae04db9cbae9e Mon Sep 17 00:00:00 2001 From: Marius Ungureanu Date: Mon, 13 Apr 2020 19:22:28 +0300 Subject: [PATCH] Use 3-arg Array.Copy in ImmutableArray.CopyTo (#32387) --- .../src/System/Collections/Immutable/ImmutableArray_1.Minimal.cs | 2 +- src/libraries/System.Collections.Immutable/tests/ImmutableArrayTest.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Minimal.cs b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Minimal.cs index 6a7695d..6d0e50f 100644 --- a/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Minimal.cs +++ b/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableArray_1.Minimal.cs @@ -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); } /// diff --git a/src/libraries/System.Collections.Immutable/tests/ImmutableArrayTest.cs b/src/libraries/System.Collections.Immutable/tests/ImmutableArrayTest.cs index 192b779..0e1a25a 100644 --- a/src/libraries/System.Collections.Immutable/tests/ImmutableArrayTest.cs +++ b/src/libraries/System.Collections.Immutable/tests/ImmutableArrayTest.cs @@ -1631,7 +1631,7 @@ namespace System.Collections.Immutable.Tests // ImmutableArray.CopyTo defers to Array.Copy for argument validation, so // the parameter names here come from Array.Copy. - AssertExtensions.Throws("destinationArray", "dest", () => array.CopyTo(null)); + AssertExtensions.Throws("destinationArray", () => array.CopyTo(null)); AssertExtensions.Throws("destinationArray", "dest", () => array.CopyTo(null, 0)); AssertExtensions.Throws("destinationArray", "dest", () => array.CopyTo(0, null, 0, 0)); AssertExtensions.Throws("destinationArray", "dest", () => array.CopyTo(-1, null, -1, -1)); // The destination should be validated first. -- 2.7.4