<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Explaining GetHashCode method.</title>
	<atom:link href="http://vkreynin.wordpress.com/2008/07/05/explaining-gethashcode-method/feed/" rel="self" type="application/rss+xml" />
	<link>http://vkreynin.wordpress.com/2008/07/05/explaining-gethashcode-method/</link>
	<description>Never stop learning.</description>
	<lastBuildDate>Fri, 18 Dec 2009 16:34:47 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Diego Deberdt</title>
		<link>http://vkreynin.wordpress.com/2008/07/05/explaining-gethashcode-method/#comment-698</link>
		<dc:creator>Diego Deberdt</dc:creator>
		<pubDate>Sun, 25 Oct 2009 17:33:24 +0000</pubDate>
		<guid isPermaLink="false">http://vkreynin.wordpress.com/2008/07/05/explaining-gethashcode-method/#comment-698</guid>
		<description>The .NET framework documentation for GetHashCode(http://msdn.microsoft.com/en-us/library/system.object.gethashcode.aspx) has some examples on how to calculate the hashcode in various classes. There does not seem to be a need to use a magic number...</description>
		<content:encoded><![CDATA[<p>The .NET framework documentation for GetHashCode(http://msdn.microsoft.com/en-us/library/system.object.gethashcode.aspx) has some examples on how to calculate the hashcode in various classes. There does not seem to be a need to use a magic number&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: NBA</title>
		<link>http://vkreynin.wordpress.com/2008/07/05/explaining-gethashcode-method/#comment-669</link>
		<dc:creator>NBA</dc:creator>
		<pubDate>Sat, 18 Jul 2009 21:43:43 +0000</pubDate>
		<guid isPermaLink="false">http://vkreynin.wordpress.com/2008/07/05/explaining-gethashcode-method/#comment-669</guid>
		<description>Aside from the flawed implementation of the hashcode, the implementation of Equals is incorrect - it will throw an exception if the object being compared to is not an instance of Point. You should check for this as well, e.g.
if (ReferenceEquals(null, obj) &amp;&amp; !(obj is Point)) return false;</description>
		<content:encoded><![CDATA[<p>Aside from the flawed implementation of the hashcode, the implementation of Equals is incorrect &#8211; it will throw an exception if the object being compared to is not an instance of Point. You should check for this as well, e.g.<br />
if (ReferenceEquals(null, obj) &amp;&amp; !(obj is Point)) return false;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vlad</title>
		<link>http://vkreynin.wordpress.com/2008/07/05/explaining-gethashcode-method/#comment-663</link>
		<dc:creator>Vlad</dc:creator>
		<pubDate>Wed, 01 Jul 2009 00:11:00 +0000</pubDate>
		<guid isPermaLink="false">http://vkreynin.wordpress.com/2008/07/05/explaining-gethashcode-method/#comment-663</guid>
		<description>This will be the best Hash for a point
((_x % Int16.MaxValue) &lt;&lt; 16) + (_y % Int16.MaxValue)</description>
		<content:encoded><![CDATA[<p>This will be the best Hash for a point<br />
((_x % Int16.MaxValue) &lt;&lt; 16) + (_y % Int16.MaxValue)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: abc_d</title>
		<link>http://vkreynin.wordpress.com/2008/07/05/explaining-gethashcode-method/#comment-625</link>
		<dc:creator>abc_d</dc:creator>
		<pubDate>Thu, 30 Apr 2009 14:53:35 +0000</pubDate>
		<guid isPermaLink="false">http://vkreynin.wordpress.com/2008/07/05/explaining-gethashcode-method/#comment-625</guid>
		<description>It&#039;s just a prime that&#039;s big enough to overflow.</description>
		<content:encoded><![CDATA[<p>It&#8217;s just a prime that&#8217;s big enough to overflow.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vadim</title>
		<link>http://vkreynin.wordpress.com/2008/07/05/explaining-gethashcode-method/#comment-512</link>
		<dc:creator>Vadim</dc:creator>
		<pubDate>Fri, 01 Aug 2008 01:34:56 +0000</pubDate>
		<guid isPermaLink="false">http://vkreynin.wordpress.com/2008/07/05/explaining-gethashcode-method/#comment-512</guid>
		<description>Chris,

(_x + _y).GetHashCode() is not a good algorithm for a Hash Code.  If _x = 2 and _y = 3, you will get the same hash code for:

(2 + 3).GetHashCode() and (3 + 2).GetHashCode().

Unfortunately I cannot answer your question about 397.  I&#039;ve seen that people smarter than I&#039;m were using this magical number so I shamelessly copied it.

If you or someone else will figure out the mystery behind 397, please drop me note.</description>
		<content:encoded><![CDATA[<p>Chris,</p>
<p>(_x + _y).GetHashCode() is not a good algorithm for a Hash Code.  If _x = 2 and _y = 3, you will get the same hash code for:</p>
<p>(2 + 3).GetHashCode() and (3 + 2).GetHashCode().</p>
<p>Unfortunately I cannot answer your question about 397.  I&#8217;ve seen that people smarter than I&#8217;m were using this magical number so I shamelessly copied it.</p>
<p>If you or someone else will figure out the mystery behind 397, please drop me note.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://vkreynin.wordpress.com/2008/07/05/explaining-gethashcode-method/#comment-511</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Thu, 31 Jul 2008 21:18:43 +0000</pubDate>
		<guid isPermaLink="false">http://vkreynin.wordpress.com/2008/07/05/explaining-gethashcode-method/#comment-511</guid>
		<description>Err, (_x.ToString() + _y.ToString()).GetHashCode()</description>
		<content:encoded><![CDATA[<p>Err, (_x.ToString() + _y.ToString()).GetHashCode()</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://vkreynin.wordpress.com/2008/07/05/explaining-gethashcode-method/#comment-510</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Thu, 31 Jul 2008 21:17:48 +0000</pubDate>
		<guid isPermaLink="false">http://vkreynin.wordpress.com/2008/07/05/explaining-gethashcode-method/#comment-510</guid>
		<description>How did you arrive at (x_ * 397) ^ _y for the value of Point.GetHashCode()? Why not (x_ * 396) ^ _y, for example, or (_x + _y).GetHashCode()?</description>
		<content:encoded><![CDATA[<p>How did you arrive at (x_ * 397) ^ _y for the value of Point.GetHashCode()? Why not (x_ * 396) ^ _y, for example, or (_x + _y).GetHashCode()?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
