[Mono-list] HashSet does not preserve add order
jonpryor at vt.edu
Sat Jan 24 13:59:20 EST 2009
On Sat, 2009-01-24 at 20:44 +0200, Andrus wrote:
> Code below produces different results in MONO and .NET .
> How to fix ?
A set is a collection that contains no duplicate elements, and
whose elements are in no particular order.
It *explicitly* states that elements are in no order, thus it is not
portable to assume that the order is in fact consistent.
You can't fix the code. You're depending on an implementation detail,
subject to change without notice.
More information about the Mono-list