<?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/"
		>
<channel>
	<title>《如何把GUID转换为整形INT数值》的评论</title>
	<atom:link href="http://magustest.com/blog/net/convert-guid-to-integer/feed/" rel="self" type="application/rss+xml" />
	<link>http://magustest.com/blog/net/convert-guid-to-integer/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=convert-guid-to-integer</link>
	<description>软件测试，自动化测试，白盒测试，Python</description>
	<lastBuildDate>Wed, 18 Jan 2012 09:08:48 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>作者：进化</title>
		<link>http://magustest.com/blog/net/convert-guid-to-integer/comment-page-1/#comment-15</link>
		<dc:creator>进化</dc:creator>
		<pubDate>Tue, 03 Feb 2009 13:43:14 +0000</pubDate>
		<guid isPermaLink="false">http://magustest.com/blog/?p=247#comment-15</guid>
		<description>@xinwei, 1000000个里面大概能赶上110多个会重复，不错啦O(∩_∩)O</description>
		<content:encoded><![CDATA[<p>@xinwei, 1000000个里面大概能赶上110多个会重复，不错啦O(∩_∩)O</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：xinwei</title>
		<link>http://magustest.com/blog/net/convert-guid-to-integer/comment-page-1/#comment-14</link>
		<dc:creator>xinwei</dc:creator>
		<pubDate>Tue, 03 Feb 2009 05:55:58 +0000</pubDate>
		<guid isPermaLink="false">http://magustest.com/blog/?p=247#comment-14</guid>
		<description>Guid改成HashCode就不能保证其唯一性了。
用hashcode就是讨厌这个地方，不同guid生成的Hashcode有可能是一样的，也就是冲突了。
比如：bd8932f2-3e53-43c1-bea7-2cebc9269ef3 和 6734397d-7fee-48da-84e2-b7e661abee67 的hashcode都是-1344638528

   Dictionary hashDic = new Dictionary();
            for (int i = 0; i &lt; 1000000; i++)
            {
                Guid guid = Guid.NewGuid();

                int guidHashCode = guid.GetHashCode();

                if (hashDic.ContainsKey(guidHashCode))
                    Trace.WriteLine(&quot;Has the Same HashCode: &quot; + guidHashCode.ToString() + &quot;&#124;&quot; + guid.ToString() + &quot;&#124;&quot; + hashDic[guidHashCode].ToString());
                else
                    hashDic.Add(guidHashCode,guid);

            }

1000000个里面大概能赶上110多个会重复，看需求了，呵呵</description>
		<content:encoded><![CDATA[<p>Guid改成HashCode就不能保证其唯一性了。<br />
用hashcode就是讨厌这个地方，不同guid生成的Hashcode有可能是一样的，也就是冲突了。<br />
比如：bd8932f2-3e53-43c1-bea7-2cebc9269ef3 和 6734397d-7fee-48da-84e2-b7e661abee67 的hashcode都是-1344638528</p>
<p>   Dictionary hashDic = new Dictionary();<br />
            for (int i = 0; i &lt; 1000000; i++)<br />
            {<br />
                Guid guid = Guid.NewGuid();</p>
<p>                int guidHashCode = guid.GetHashCode();</p>
<p>                if (hashDic.ContainsKey(guidHashCode))<br />
                    Trace.WriteLine(“Has the Same HashCode: ” + guidHashCode.ToString() + “|” + guid.ToString() + “|” + hashDic[guidHashCode].ToString());<br />
                else<br />
                    hashDic.Add(guidHashCode,guid);</p>
<p>            }</p>
<p>1000000个里面大概能赶上110多个会重复，看需求了，呵呵</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：进化</title>
		<link>
