<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Also of interest to this discussion is the following from a discussion on C#’s version of Set:<div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><p style="margin: 0px 0px 1em; padding: 0px; border: 0px; font-variant-ligatures: normal; font-variant-numeric: inherit; font-stretch: inherit; font-size: 15px; line-height: inherit; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; vertical-align: baseline; clear: both; color: rgb(36, 39, 41); orphans: 2; widows: 2; background-color: rgb(255, 255, 255);" class=""><code style="margin: 0px; padding: 1px 5px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: 13px; line-height: inherit; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; vertical-align: baseline; background-color: rgb(239, 240, 241); white-space: pre-wrap;" class="">HashSet&lt;T&gt;</code>&nbsp;is more or less modeled after a&nbsp;<a href="http://en.wikipedia.org/wiki/Set_(mathematics)" rel="noreferrer" title="Wikipedia article" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 89, 153); text-decoration: none; cursor: pointer;" class="">mathematical set</a>, which means that:</p><ol style="margin: 0px 0px 1em 30px; padding: 0px; border: 0px; font-variant-ligatures: normal; font-variant-numeric: inherit; font-stretch: inherit; font-size: 15px; line-height: inherit; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; vertical-align: baseline; list-style-position: initial; list-style-image: initial; color: rgb(36, 39, 41); orphans: 2; widows: 2; background-color: rgb(255, 255, 255);" class=""><li style="margin: 0px 0px 0.5em; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; word-wrap: break-word;" class=""><div style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; clear: both;" class="">It may contain no duplicate values.</div></li><li style="margin: 0px 0px 0.5em; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; word-wrap: break-word;" class=""><div style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; clear: both;" class="">Its elements are in no particular order; therefore the type does not implement the&nbsp;<a href="http://msdn.microsoft.com/en-us/library/5y536ey6.aspx" rel="noreferrer" title="MSDN reference page" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 89, 153); text-decoration: none; cursor: pointer;" class=""><code style="margin: 0px; padding: 1px 5px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: 13px; line-height: inherit; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; vertical-align: baseline; background-color: rgb(239, 240, 241); white-space: pre-wrap;" class="">IList&lt;T&gt;</code></a>interface, but the more basic&nbsp;<a href="http://msdn.microsoft.com/en-us/library/92t2ye13.aspx" rel="noreferrer" title="MSDN reference page" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline; color: rgb(0, 89, 153); text-decoration: none; cursor: pointer;" class=""><code style="margin: 0px; padding: 1px 5px; border: 0px; font-style: inherit; font-variant-ligatures: inherit; font-variant-position: inherit; font-variant-caps: inherit; font-variant-numeric: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-stretch: inherit; font-size: 13px; line-height: inherit; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; vertical-align: baseline; background-color: rgb(239, 240, 241); white-space: pre-wrap;" class="">ICollection&lt;T&gt;</code></a>. As a consequence, elements inside a hash set cannot be randomly accessed through indices; they can only be iterated over through an enumerator.</div></li></ol></blockquote><div class="">So, it appears that C#/.Net does in fact take into account the fact that Sets are unordered, and only allows it to be iterated (as opposed to accessed with indices).</div></div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Jon</div></body></html>