KEMBAR78
`IListProvider<T>.ToList()` implementations use `list.Add(element)` instead of direct array initialization. · Issue #80760 · dotnet/runtime · GitHub
Skip to content

IListProvider<T>.ToList() implementations use list.Add(element) instead of direct array initialization. #80760

@neon-sunset

Description

@neon-sunset

Description

IListProvider<T>.ToList() implementations in System.Linq for iterators of known lengths use list.Add(element) to initialize the list over directly writing to its underlying array.

This is to not forget to update the implementations once any of the following is done: #80311, #55217 or #80756.

Configuration

All versions

Regression?

No

Analysis

Once we have an API for direct List<T> initialization (aside from new List<T>(collection)), it's a good idea to utilize it in BCL to reduce the overhead.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions