1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-22 18:58:47 +00:00

🛠 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

View File

@ -129,7 +129,7 @@
/// <paramref name="count"/> times.</returns>
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++)
{