Co-authored-by: Jared Parsons <jared@paranoidcoding.org>
This commit is contained in:
Dustin Campbell 2024-09-10 08:11:53 -07:00 коммит произвёл GitHub
Родитель a3fe4c96d9
Коммит 665e11649c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -53,7 +53,7 @@
> **Be mindful of ToArray()** > **Be mindful of ToArray()**
> >
> Calling `ToArray()` on a collection will create a new array and copy content from the collection into it. So, when > Calling `ToArray()` on a collection will create a new array and copy content from the collection into it. So, when
> the exact capacity is known up front, it is an anti-pattern to create a `List<T>` withwout that capacity, fill it > the exact capacity is known up front, it is an anti-pattern to create a `List<T>` without that capacity, fill it
> with items and then call `ToArray()` at the end. This results in extra allocations that could be avoided by creating > with items and then call `ToArray()` at the end. This results in extra allocations that could be avoided by creating
> an array and filling it. > an array and filling it.