I am trying to build a query that select unique groups of values. I know how to group values and select distinct values, but I don’t see how to select distinct groups of values regarless of the order of the elements considered. More precisely:
My XML is something like this:
<A>
<B type="1">value1</prop>
<B type="2">value2</prop>
<B type="3">value3</prop>
<B type="4">value4</prop>
<C>
<D>XXX</D>
</C>
<C>
<D>YYY</D>
</C>
</A>
<A>
<B type="3">value3</prop>
<B type="4">value4</prop>
<B type="2">value2</prop>
<C>
<D>XXX</D>
</C>
<C>
<D>YYY</D>
</C>
</A>
Here I would like to make groups of <B> values from all <A> nodes and select only unique sets of values. For instance, here:
value1+value2+value3+value4
and
value2+value3+value4+value1
These two sets of values should be only unique if some or all of the values are different.
Thank you very much in advance for your help.
The following works:
This returns distinct groups. A group is seen as the same as another group if the elements in the group have the same values as the elements in the other group.
Unfortunatelly, we need a full blown
IEqualityComparerimplementation to achieve this.