Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autofac and Collection Expressions #1443

Open
TonyValenti opened this issue Jan 7, 2025 · 1 comment
Open

Autofac and Collection Expressions #1443

TonyValenti opened this issue Jan 7, 2025 · 1 comment
Labels
enhancement pending-input Pending input or update

Comments

@TonyValenti
Copy link

Problem Statement

The C# language has evolved and now supports constructing arbitrary collections via collection expressions.

Autofac should use similar logic when constructing collections. This will allow many more collection types (such as ImmutableList and ImmutableArray) to be used.

Desired Solution

Any collection constructable by a collection expression should be constructable by Autofac.

Alternatives You've Considered

Leave things as-is.

@tillig
Copy link
Member

tillig commented Jan 7, 2025

Last time this got filed - #1408 - we asked for a bit more up front research and info on how this should work. That info was never provided so the other issue was closed.

I'll leave this one open for a week pending the input, them I'll close this one, too.

"Just work with all collection expression types" isn't enough - you actually need to do the work to get the list of those types. Given Autofac is not the compiler and collection expressions are a syntactic sugar added by the compiler (just like async/await generate the thread handling code for you), there's no way to "just handle" every collection type. We actually have to know about it, reflection style, so we can manually construct it.

I'm sorry that means extra work for you, but we need to rely on the folks filling the requests to do the leg-work to define new features in detail. There's not enough time or people to do that for you.

@tillig tillig added enhancement pending-input Pending input or update labels Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement pending-input Pending input or update
Projects
None yet
Development

No branches or pull requests

2 participants