-
-
Notifications
You must be signed in to change notification settings - Fork 149
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
Support System.Collections.Immutable types #250
Comments
While this feature is not implemented is there a generic way to work around this? Something like: private static ImmutableList<TDest> ToImmutableList<TDest, TSource>(
IEnumberable<TSource> source,
Func<TSource, TDest> map
)
{
return source.Select(map).ToImmutableList();
} We can obviously add a workaround for each type but it doesn't seem to be possible to implement it generically. |
Currently there is no support for generic user implemented mapping methods... I can't think of a feasible workaround 😢 |
Thanks for the response. Without knowing too much about how source generators work, would it not be possible to support the suggested code? This could be useful for any generic type with a single type argument. if you know how to map from |
I'll give it a go. Looks like |
@TimothyMakkison nice 😊 The immutable collections are available in the immutable namespace. IMO Mapperly should probably support all generic implementations:
Some may need more effort than others, therefore it could make sense to split this up into multiple PR's. |
@jamesfoster this could probably be a new feature of Mapperly. However, I think it adds a lot of complexity and I'm not sure if it justifies the added complexity. |
No worries. My use case was immutable collections anyway, and it looks like you're working on it. I can work around it for the time being by adding the non-generic mapper for each type as needed. Thanks. |
#305 implements support for the following immutable collections:
Still missing:
Thanks to @TimothyMakkison for the contribution 🎉 |
Thanks to another great contribution from @TimothyMakkison |
This issue has been released in version 2.8.0-next.2 which is available on nuget. |
Support collection types in
System.Collections.Immutable
as mapping target types.Eg. Mapperly should be able to implement a mapping from an
IEnumerable<long>
to anImmutableList<int>
.The text was updated successfully, but these errors were encountered: