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

Type restrictions on With and WithSharedRef make generic usage of the library a little awkward #16

Open
benbelow opened this issue Jan 5, 2022 · 0 comments

Comments

@benbelow
Copy link
Member

benbelow commented Jan 5, 2022

For example, if I have a class Foo<T> with a property T Bar.

In v1 of the library, I could define an extension method WithBar(T myT) => builder.With(x => x.Bar, mtY), and it would work nicely.

In v4, there are type restrictions enforcing that With can only be called if T : struct, and WithSharedRef can only be called if T : class

This renders my example extension method no longer feasible, provided T is not restricted to either a struct or a class.

@Brondahl has pointed out that WithCustomSetup can be used, but it's not ideal.

Ideally we'll tweak the API such that this case is neatly supported - but in the worst case we can just call out this case in the REAMDE

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

1 participant