Since immutable data structures are first-class values, we can compare them for equality or order, as for any other values. However, in previewing BCL collections, things got complicated because each immutable collection can be parameterized by instances of IEqualityComparer<T> / IComparer<T> . It seems that immutable collections with different mappers should not be mapped (since equality is not defined for the mappings themselves), since it makes the equality relation asymmetric:
var xs = ImmutableList<string>.Empty.Add("AAA") .WithComparer(StringComparer.OrdinalIgnoreCase); var ys = ImmutableList<string>.Empty.Add("aaa") .WithComparer(StringComparer.Ordinal); Console.WriteLine(xs.Equals(ys));
Will this fix be fixed in any way?
source share