🛠 Pre-allocate StringBuilder capacity

This commit is contained in:
Oliver Booth 2020-04-17 18:03:50 +01:00
parent 3afc1d967c
commit 5f8458f185
No known key found for this signature in database
GPG Key ID: 0D7F2EF1C8D2B9C0
1 changed files with 1 additions and 1 deletions

View File

@ -129,7 +129,7 @@
/// <paramref name="count"/> times.</returns> /// <paramref name="count"/> times.</returns>
public static string Repeat(this string str, int count) public static string Repeat(this string str, int count)
{ {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder(str.Length * count);
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {