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

Natively support injecting IReadOnlyCollection<T> and ImmutableArray<T> #134

Closed
jnm2 opened this issue Aug 4, 2021 · 4 comments
Closed

Comments

@jnm2
Copy link
Contributor

jnm2 commented Aug 4, 2021

It's nice if classes don't require a type that they can mutate (T[]). It's a small thing, but it could matter if the type is also used without StrongInject, for example in test code.

I use ImmutableArray<T> except in existing projects that can't or don't yet reference System.Collections.Immutable.

The reason I'm not asking about IReadOnlyList<T> is that I use that type instead of IReadOnlyCollection<T> when I want to imply that the index order is significant. I'm assuming that StrongInject doesn't have an ordering guarantee that is obvious to the reader since it could be collecting implementations from various separate files.

@YairHalberstadt
Copy link
Owner

You can get these types by importing the inbuilt StrongInject.Modules.StandardModule.

The reason I didn't make these automatically available is that at the time I found the model of how they would be user overridden complex to reason about. It may be that if I think about this a bit more I'll decide it's actually relatively straightforward.

@jnm2
Copy link
Contributor Author

jnm2 commented Aug 4, 2021

Thanks! There are other things in there that I will want too. Could the error messages give this hint when the missing type is in the standard module?

@YairHalberstadt
Copy link
Owner

That's definitely a good option. It can on the backlog! :-)

@jnm2
Copy link
Contributor Author

jnm2 commented Aug 4, 2021

Okay, I added it to the backlog. You can close this unless you would like to use this issue to track the further thought you mentioned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants