Recently I upgraded one of my projects to use .NET 6
. Earlier I was using MoreLinq library to use DistinctBy()
to apply it on the specific property.
Now as I upgraded TargetFramework to .NET 6
, this change come up with inbuilt support to DistinctBy()
.
Now the compiler is confused about which DistinctBy()
needs to select, I can't rely on System.Linq
, because the removal of using MoreLinq
will cause multiple other errors.
I know if we face ambiguity between the same methods then we can use using alias
, but I am not sure how to use using alias
for Linq extension methods.
Here is the error:
I am able to replicate the same issue in the below fiddle
MoreLinq.MoreEnumerable.DistinctBy(yourEnumerable, otherParams)
– Cisternausing System.Linq;
– CisternaDistinctBy
. – Shank