Skip to content

Commit ee72dc8

Browse files
authored
Use Array.Copy in Match.AddMatch (#122894)
1 parent 178bc48 commit ee72dc8

File tree

1 file changed

+1
-4
lines changed
  • src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions

1 file changed

+1
-4
lines changed

src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Match.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,7 @@ internal void AddMatch(int cap, int start, int len)
177177
{
178178
int[] oldmatches = matches[cap];
179179
int[] newmatches = new int[capcount * 8];
180-
for (int j = 0; j < capcount * 2; j++)
181-
{
182-
newmatches[j] = oldmatches[j];
183-
}
180+
Array.Copy(oldmatches, newmatches, capcount * 2);
184181

185182
matches[cap] = newmatches;
186183
}

0 commit comments

Comments
 (0)