Skip to content

Minimze empty array allocations via centralized helper for pre-net46 #4041

Description

@stevenaw

net462 + netstandard2 define a static Array.Empty<T>() helper which returns a cached empty array. There's a few places in the code where we #ifdef this in where it's easy but there's other places where this approach would be cumbersome. It might help to both cleanup the code + give a minor perf boost (via reduced allocations) by creating a helper to handle this.

This would be most useful for v3.13.x but could also have a place in v4 if we continue to target net45 there (#4036). If net45 support is dropped in v4, then we should instead update all callsites to just call Array.Empty<T> directly instead

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions