Skip to content

Linq (Enumerable.cs) should provide overloads for functions that can benefit heavily from knowing the static type of the receiver. #16928

@CyrusNajmabadi

Description

@CyrusNajmabadi

Methods like Enumerable.Last work terribly if you pass in something that implements IReadOnlyList but not IList. We could provide additional overloads like: public static T Last<T>(this IReadOnlyList<T> list) { ... } so that we now had optimized implementations for these types.

This would also be beneficial so we can have codepaths that avoid having to dynamically check the type of the receiver at runtime when the compiler already knows statically what it can dispatch to.

Metadata

Metadata

Assignees

Labels

api-needs-workAPI needs work before it is approved, it is NOT ready for implementationarea-System.Linq

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions