<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	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>Vadim's Weblog &#187; VS2005</title>
	<atom:link href="http://vkreynin.wordpress.com/category/vs2005/feed/" rel="self" type="application/rss+xml" />
	<link>http://vkreynin.wordpress.com</link>
	<description>Never stop learning.</description>
	<lastBuildDate>Wed, 26 Aug 2009 11:54:05 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='vkreynin.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/1173064e3df3d2dd6e336993810ee5b5?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Vadim's Weblog &#187; VS2005</title>
		<link>http://vkreynin.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://vkreynin.wordpress.com/osd.xml" title="Vadim&#8217;s Weblog" />
		<item>
		<title>Incremental search in Visual Studio</title>
		<link>http://vkreynin.wordpress.com/2008/10/18/incremental-search-in-visual-studio/</link>
		<comments>http://vkreynin.wordpress.com/2008/10/18/incremental-search-in-visual-studio/#comments</comments>
		<pubDate>Sat, 18 Oct 2008 21:07:42 +0000</pubDate>
		<dc:creator>Vadim</dc:creator>
				<category><![CDATA[Tips And Tricks]]></category>
		<category><![CDATA[VS2005]]></category>
		<category><![CDATA[VS2008]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Incremental Search]]></category>

		<guid isPermaLink="false">http://vkreynin.wordpress.com/2008/10/18/incremental-search-in-visual-studio/</guid>
		<description><![CDATA[When you&#8217;re writing code in VS environment, I bet that you often use Ctrl+F keystroke to display &#8220;Find and Replace&#8221; dialog box.
There&#8217;s a better way.&#160; Next time you need to look for some text in your code, press Ctrl+I and start typing your search.&#160; After the text is found, you can use F3 key to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vkreynin.wordpress.com&blog=1150196&post=159&subd=vkreynin&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>When you&#8217;re writing code in VS environment, I bet that you often use Ctrl+F keystroke to display &#8220;Find and Replace&#8221; dialog box.</p>
<p>There&#8217;s a better way.&nbsp; Next time you need to look for some text in your code, press Ctrl+I and start typing your search.&nbsp; After the text is found, you can use F3 key to find a next occurrence. </p>
<p>As soon as you press Ctrl+I, you&#8217;ll see &#8220;Incremental Search:&#8221; label<a href="http://vkreynin.files.wordpress.com/2008/10/incrementalsearch.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="121" alt="IncrementalSearch" src="http://vkreynin.files.wordpress.com/2008/10/incrementalsearch-thumb.png?w=288&#038;h=121" width="288" align="left" border="0"></a> on the left part of VS status bar.&nbsp; Your search text will appear on the status bar as you type it.&nbsp; If you mistype your search text, you can use Backspace key to correct wrong characters.</p>
<p>
<a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fvkreynin.wordpress.com%2f2008%2f10%2f18%2fincremental-search-in-visual-studio%2f"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fvkreynin.wordpress.com%2f2008%2f10%2f18%2fincremental-search-in-visual-studio%2f" border="0" alt="kick it on DotNetKicks.com" /></a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vkreynin.wordpress.com/159/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vkreynin.wordpress.com/159/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vkreynin.wordpress.com/159/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vkreynin.wordpress.com/159/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vkreynin.wordpress.com/159/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vkreynin.wordpress.com/159/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vkreynin.wordpress.com/159/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vkreynin.wordpress.com/159/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vkreynin.wordpress.com/159/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vkreynin.wordpress.com/159/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vkreynin.wordpress.com&blog=1150196&post=159&subd=vkreynin&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vkreynin.wordpress.com/2008/10/18/incremental-search-in-visual-studio/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0bdbc8162336851af022196f897d6200?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vkreynin</media:title>
		</media:content>

		<media:content url="http://vkreynin.files.wordpress.com/2008/10/incrementalsearch-thumb.png" medium="image">
			<media:title type="html">IncrementalSearch</media:title>
		</media:content>

		<media:content url="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fvkreynin.wordpress.com%2f2008%2f10%2f18%2fincremental-search-in-visual-studio%2f" medium="image">
			<media:title type="html">kick it on DotNetKicks.com</media:title>
		</media:content>
	</item>
		<item>
		<title>Explaining GetHashCode method.</title>
		<link>http://vkreynin.wordpress.com/2008/07/05/explaining-gethashcode-method/</link>
		<comments>http://vkreynin.wordpress.com/2008/07/05/explaining-gethashcode-method/#comments</comments>
		<pubDate>Sun, 06 Jul 2008 02:44:43 +0000</pubDate>
		<dc:creator>Vadim</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[GetHashTable]]></category>
		<category><![CDATA[VS2005]]></category>
		<category><![CDATA[VS2008]]></category>

		<guid isPermaLink="false">http://vkreynin.wordpress.com/2008/07/05/explaining-gethashcode-method/</guid>
		<description><![CDATA[Every object you ever created or used in .NET has GetHashCode method along with Equals, GetType, and ToString methods.&#160; This method is an instance method of an Object class from which any other class derives.
&#160; 
GetHashCode() method returns an integer that identifies an object instance.&#160; I also can repeat MSDN documentation but you can read [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vkreynin.wordpress.com&blog=1150196&post=126&subd=vkreynin&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Every object you ever created or used in .NET has GetHashCode method along with Equals, GetType, and ToString methods.&nbsp; This method is an instance method of an Object class from which any other class derives.</p>
<p><a href="http://vkreynin.files.wordpress.com/2008/07/gethashcodeintelisense.png"><img style="border-width:0;" height="139" alt="GetHashCodeIntelisense" src="http://vkreynin.files.wordpress.com/2008/07/gethashcodeintelisense-thumb.png?w=434&#038;h=139" width="434" border="0"></a>&nbsp; </p>
<p>GetHashCode() method returns an integer that identifies an object instance.&nbsp; I also can repeat MSDN documentation but you can <a title="Object.GetHashCode Method" href="http://msdn.microsoft.com/en-us/library/system.object.gethashcode.aspx" target="_blank">read it on your own</a>.</p>
<p>You would want to override this method along with <a href="http://msdn.microsoft.com/en-us/library/bsc2ak47.aspx" target="_blank">Equals() method</a> in your class if the object of your class is going to be used as a key in <a href="http://msdn.microsoft.com/en-us/library/system.collections.hashtable.aspx" target="_blank">Hashtable</a>.</p>
<p>The best way to explain it is to show an example. In <a title="Comparing Reference Types in Unit Tests." href="http://vkreynin.wordpress.com/2008/07/03/comparing-reference-types-in-unit-tests/" target="_blank" rel="tag">my previous post</a> I was using class Point as an example.&nbsp; I&#8217;m going to continue with this class.&nbsp; So let assume that we have class like this:</p>
<div style="border-right:gray 1px solid;border-top:gray 1px solid;font-size:8pt;overflow:auto;border-left:gray 1px solid;width:97.5%;cursor:text;max-height:200px;line-height:12pt;border-bottom:gray 1px solid;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;margin:20px 0 10px;padding:4px;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;padding:0;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   1:</span> <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> Point</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   2:</span> {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   3:</span>   <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">readonly</span> <span style="color:#0000ff;">int</span> _x;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   4:</span>   <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">readonly</span> <span style="color:#0000ff;">int</span> _y;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   5:</span>&nbsp; </pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   6:</span>   <span style="color:#0000ff;">public</span> Point(<span style="color:#0000ff;">int</span> x, <span style="color:#0000ff;">int</span> y)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   7:</span>   {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   8:</span>     _x = x;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   9:</span>     _y = y;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  10:</span>   }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  11:</span> }</pre>
</div>
</div>
<p>Next we want to use Point as a key in a Hashtable.&nbsp; Remember that the key of the Hasthable must be unique.&nbsp; In the code bellow we have two identical keys (line 2 &amp; 4). We should expect ArgumentException.</p>
<div style="border-right:gray 1px solid;border-top:gray 1px solid;font-size:8pt;overflow:auto;border-left:gray 1px solid;width:97.5%;cursor:text;max-height:200px;line-height:12pt;border-bottom:gray 1px solid;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;margin:20px 0 10px;padding:4px;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;padding:0;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   1:</span> Hashtable hashtable = <span style="color:#0000ff;">new</span> Hashtable();</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   2:</span> hashtable.Add(<span style="color:#0000ff;">new</span> Point(2, 3), <span style="color:#006080;">"Point 1"</span>);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   3:</span> hashtable.Add(<span style="color:#0000ff;">new</span> Point(5, 3), <span style="color:#006080;">"Point 2"</span>);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   4:</span> hashtable.Add(<span style="color:#0000ff;">new</span> Point(2, 3), <span style="color:#006080;">"Point 3"</span>);</pre>
</div>
</div>
<p>However, no exception was thrown.&nbsp; There are two reasons why exception is not thrown:</p>
<ol>
<li><a href="http://msdn.microsoft.com/en-us/library/bsc2ak47.aspx" target="_blank">Equals() method</a> that is also an instance method of Object class will always indicate that Point in line 2 and line 4 are different. This expected because two objects have different references.
<li>GetHashTable() method returns different number for these objects.</li>
</ol>
<p>Try to execute code bellow:</p>
<div style="border-right:gray 1px solid;border-top:gray 1px solid;font-size:8pt;overflow:auto;border-left:gray 1px solid;width:97.5%;cursor:text;max-height:200px;line-height:12pt;border-bottom:gray 1px solid;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;margin:20px 0 10px;padding:4px;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;padding:0;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   1:</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">void</span> Main(<span style="color:#0000ff;">string</span>[] args)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   2:</span>  {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   3:</span>    var point1 = <span style="color:#0000ff;">new</span> Point(2, 3);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   4:</span>    var point2 = <span style="color:#0000ff;">new</span> Point(2, 3);</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   5:</span>    Console.WriteLine(<span style="color:#006080;">"point1 Hash: {0}"</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   6:</span>         , point1.GetHashCode());</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   7:</span>    Console.WriteLine(<span style="color:#006080;">"point2 Hash: {0}"</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   8:</span>         , point2.GetHashCode());</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   9:</span>    Console.WriteLine(<span style="color:#006080;">"point1 equal to point2: {0}"</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  10:</span>         , point1.Equals(point2));</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  11:</span>  }</pre>
</div>
</div>
<p>You will get output similar to this one:</p>
<p><font face="Courier New" color="#3b3b3b" size="2">point1 Hash: 58225482<br />point2 Hash: 54267293<br />point1 equal to point2: False</font> </p>
<p>You can see that we got different hash codes.</p>
<p>To solve this problem we override Equal() and GetHashTable() in our Point class.</p>
<p>First we override Equals() method:</p>
<div style="border-right:gray 1px solid;border-top:gray 1px solid;font-size:8pt;overflow:auto;border-left:gray 1px solid;width:97.5%;cursor:text;max-height:200px;line-height:12pt;border-bottom:gray 1px solid;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;margin:20px 0 10px;padding:4px;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;padding:0;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   1:</span> <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">override</span> <span style="color:#0000ff;">bool</span> Equals(<span style="color:#0000ff;">object</span> obj)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   2:</span> {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   3:</span>   <span style="color:#0000ff;">if</span> (ReferenceEquals(<span style="color:#0000ff;">null</span>, obj)) <span style="color:#0000ff;">return</span> <span style="color:#0000ff;">false</span>;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   4:</span>   <span style="color:#0000ff;">if</span> (ReferenceEquals(<span style="color:#0000ff;">this</span>, obj)) <span style="color:#0000ff;">return</span> <span style="color:#0000ff;">true</span>;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   5:</span>   <span style="color:#0000ff;">return</span> ((Point)obj)._x == _x &amp;&amp; ((Point)obj)._y == _y;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   6:</span> }</pre>
</div>
</div>
<p>You can see that I use <a href="http://msdn.microsoft.com/en-us/library/system.object.referenceequals.aspx" target="_blank">ReferenceEquals() method</a> that is static method of Object class.&nbsp; It checks if the specified objects are the same.</p>
<p>Next we override GetHashTable() method:</p>
<div style="border-right:gray 1px solid;border-top:gray 1px solid;font-size:8pt;overflow:auto;border-left:gray 1px solid;width:97.5%;cursor:text;max-height:200px;line-height:12pt;border-bottom:gray 1px solid;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;margin:20px 0 10px;padding:4px;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;padding:0;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   1:</span> <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">override</span> <span style="color:#0000ff;">int</span> GetHashCode()</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   2:</span> {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   3:</span>   <span style="color:#0000ff;">unchecked</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   4:</span>   {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   5:</span>     <span style="color:#0000ff;">return</span> (_x * 397) ^ _y;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   6:</span>   }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   7:</span> }</pre>
</div>
</div>
<p>The whole Point would look like this:</p>
<div style="border-right:gray 1px solid;border-top:gray 1px solid;font-size:8pt;overflow:auto;border-left:gray 1px solid;width:97.5%;cursor:text;max-height:200px;line-height:12pt;border-bottom:gray 1px solid;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;margin:20px 0 10px;padding:4px;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;padding:0;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   1:</span> <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> Point</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   2:</span> {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   3:</span>   <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">readonly</span> <span style="color:#0000ff;">int</span> _x;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   4:</span>   <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">readonly</span> <span style="color:#0000ff;">int</span> _y;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   5:</span>&nbsp; </pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   6:</span>   <span style="color:#0000ff;">public</span> Point(<span style="color:#0000ff;">int</span> x, <span style="color:#0000ff;">int</span> y)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   7:</span>   {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   8:</span>     _x = x;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   9:</span>     _y = y;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  10:</span>   }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  11:</span>&nbsp; </pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  12:</span>   <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">override</span> <span style="color:#0000ff;">bool</span> Equals(<span style="color:#0000ff;">object</span> obj)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  13:</span>   {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  14:</span>     <span style="color:#0000ff;">if</span> (ReferenceEquals(<span style="color:#0000ff;">null</span>, obj)) <span style="color:#0000ff;">return</span> <span style="color:#0000ff;">false</span>;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  15:</span>     <span style="color:#0000ff;">if</span> (ReferenceEquals(<span style="color:#0000ff;">this</span>, obj)) <span style="color:#0000ff;">return</span> <span style="color:#0000ff;">true</span>;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  16:</span>     <span style="color:#0000ff;">return</span> ((Point)obj)._x == _x &amp;&amp; ((Point)obj)._y == _y;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  17:</span>   }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  18:</span>&nbsp; </pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  19:</span>   <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">override</span> <span style="color:#0000ff;">int</span> GetHashCode()</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  20:</span>   {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  21:</span>     <span style="color:#0000ff;">unchecked</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  22:</span>     {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  23:</span>       <span style="color:#0000ff;">return</span> (_x * 397) ^ _y;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  24:</span>     }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  25:</span>   }</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  26:</span> }</pre>
</div>
</div>
<p>Now if you try to execute the application the output should look exactly like this:</p>
<p><font face="Courier New" size="2">point1 Hash: 793<br />point2 Hash: 793<br />point1 equal to point2: True</font> </p>
<p>Also if we try to add new Point(2, 3) twice, we get an ArgumentException as expected.</p>
<p><a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fvkreynin.wordpress.com%2f2008%2f07%2f05%2fexplaining-gethashcode-method%2f"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fvkreynin.wordpress.com%2f2008%2f07%2f05%2fexplaining-gethashcode-method%2f" border="0" alt="kick it on DotNetKicks.com" /></a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vkreynin.wordpress.com/126/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vkreynin.wordpress.com/126/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vkreynin.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vkreynin.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vkreynin.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vkreynin.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vkreynin.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vkreynin.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vkreynin.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vkreynin.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vkreynin.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vkreynin.wordpress.com/126/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vkreynin.wordpress.com&blog=1150196&post=126&subd=vkreynin&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vkreynin.wordpress.com/2008/07/05/explaining-gethashcode-method/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0bdbc8162336851af022196f897d6200?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vkreynin</media:title>
		</media:content>

		<media:content url="http://vkreynin.files.wordpress.com/2008/07/gethashcodeintelisense-thumb.png" medium="image">
			<media:title type="html">GetHashCodeIntelisense</media:title>
		</media:content>

		<media:content url="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fvkreynin.wordpress.com%2f2008%2f07%2f05%2fexplaining-gethashcode-method%2f" medium="image">
			<media:title type="html">kick it on DotNetKicks.com</media:title>
		</media:content>
	</item>
		<item>
		<title>Where&#8217;s my R# File Templates?</title>
		<link>http://vkreynin.wordpress.com/2008/05/27/wheres-my-r-file-templates/</link>
		<comments>http://vkreynin.wordpress.com/2008/05/27/wheres-my-r-file-templates/#comments</comments>
		<pubDate>Tue, 27 May 2008 20:40:19 +0000</pubDate>
		<dc:creator>Vadim</dc:creator>
				<category><![CDATA[ReSharper]]></category>
		<category><![CDATA[VS2005]]></category>

		<guid isPermaLink="false">http://vkreynin.wordpress.com/2008/05/27/wheres-my-r-file-templates/</guid>
		<description><![CDATA[After installing ReSharper 4.0 Beta over a previous version, my user defined File Templates disappeared.&#160; I was able to use my user defined Live Templates.&#160; After some investigation, I was able to figure out how to get them back.
Actually they didn&#8217;t disappear, I just had to associate them with project types.
 
In case the same [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vkreynin.wordpress.com&blog=1150196&post=98&subd=vkreynin&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>After installing <a href="http://www.jetbrains.com/resharper/beta/beta.html">ReSharper 4.0 Beta</a> over a <a title="ReSharper 3.1" href="http://www.jetbrains.com/resharper/">previous version</a>, my user defined <a href="http://www.jetbrains.com/resharper/features/code_templates.html">File Templates</a> disappeared.&nbsp; I was able to use my user defined Live Templates.&nbsp; After some investigation, I was able to figure out how to get them back.</p>
<p>Actually they didn&#8217;t disappear, I just had to associate them with project types.</p>
<p><a href="http://vkreynin.files.wordpress.com/2008/05/reshrp-template.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="244" alt="reShrp_template" src="http://vkreynin.files.wordpress.com/2008/05/reshrp-template-thumb.png?w=221&#038;h=244" width="221" align="right" border="0"></a> </p>
<p>In case the same happens to you and you cannot find your File Templates here are the steps to get them back.</p>
<p>1. Follow the same steps as you would do when a adding a new item: </p>
<p>Click right button on your project in Visual Studio and select Add -&gt; New from Template -&gt; More&#8230; . </p>
<p>Now you should see &#8216;Choose Template&#8217; dialog.</p>
<p>&nbsp;</p>
<p>2. In &#8216;Choose Template&#8217; dialog click on &#8216;Add to quicklist&#8217; check box and select the type of the project your template should belong.&nbsp; In my case I had to select &#8216;C# Projects&#8217;</p>
<p><a href="http://vkreynin.files.wordpress.com/2008/05/choose-template.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="244" alt="choose_template" src="http://vkreynin.files.wordpress.com/2008/05/choose-template-thumb.png?w=193&#038;h=244" width="193" border="0"></a> </p>
<p>I just want to mentioned that this behavior I&#8217;ve happened in VS2005, I haven&#8217;t check what happens in VS 2008.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vkreynin.wordpress.com/98/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vkreynin.wordpress.com/98/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vkreynin.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vkreynin.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vkreynin.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vkreynin.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vkreynin.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vkreynin.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vkreynin.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vkreynin.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vkreynin.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vkreynin.wordpress.com/98/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vkreynin.wordpress.com&blog=1150196&post=98&subd=vkreynin&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vkreynin.wordpress.com/2008/05/27/wheres-my-r-file-templates/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0bdbc8162336851af022196f897d6200?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vkreynin</media:title>
		</media:content>

		<media:content url="http://vkreynin.files.wordpress.com/2008/05/reshrp-template-thumb.png" medium="image">
			<media:title type="html">reShrp_template</media:title>
		</media:content>

		<media:content url="http://vkreynin.files.wordpress.com/2008/05/choose-template-thumb.png" medium="image">
			<media:title type="html">choose_template</media:title>
		</media:content>
	</item>
		<item>
		<title>VS 2005 fails to load.</title>
		<link>http://vkreynin.wordpress.com/2008/05/23/vs-2005-fails-to-load/</link>
		<comments>http://vkreynin.wordpress.com/2008/05/23/vs-2005-fails-to-load/#comments</comments>
		<pubDate>Sat, 24 May 2008 01:55:15 +0000</pubDate>
		<dc:creator>Vadim</dc:creator>
				<category><![CDATA[VS2005]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://vkreynin.wordpress.com/2008/05/23/vs-2005-fails-to-load/</guid>
		<description><![CDATA[On two different occasions I was asked to help when VS 2005 would not load.&#160; We were able see only VS 2005 splash screen and that&#8217;s it.&#160; In first case the CPU usage by devenv.exe was 25%.&#160; To resolve this problem I launched VS in safe mode.&#160; 
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE&#62;devenv.exe /SafeMode
This prevents all [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vkreynin.wordpress.com&blog=1150196&post=92&subd=vkreynin&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>On two different occasions I was asked to help when VS 2005 would not load.&nbsp; We were able see only VS 2005 splash screen and that&#8217;s it.&nbsp; In first case the CPU usage by devenv.exe was 25%.&nbsp; To resolve this problem I launched VS in safe mode.&nbsp; </p>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">C:\Program Files\Microsoft Visual Studio 8\Common7\IDE&gt;devenv.exe /SafeMode</pre>
<p>This prevents all third-party VSPakages from loading.&nbsp; After that VS 2005 was loading properly all the time.</p>
<p>I believe that in both cases it happened after the developer installed an add-in.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vkreynin.wordpress.com/92/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vkreynin.wordpress.com/92/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vkreynin.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vkreynin.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vkreynin.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vkreynin.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vkreynin.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vkreynin.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vkreynin.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vkreynin.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vkreynin.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vkreynin.wordpress.com/92/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vkreynin.wordpress.com&blog=1150196&post=92&subd=vkreynin&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vkreynin.wordpress.com/2008/05/23/vs-2005-fails-to-load/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0bdbc8162336851af022196f897d6200?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vkreynin</media:title>
		</media:content>
	</item>
		<item>
		<title>How To: Create a ReSharper File Template.</title>
		<link>http://vkreynin.wordpress.com/2008/04/01/how-to-create-a-resharper-file-template/</link>
		<comments>http://vkreynin.wordpress.com/2008/04/01/how-to-create-a-resharper-file-template/#comments</comments>
		<pubDate>Wed, 02 Apr 2008 02:25:37 +0000</pubDate>
		<dc:creator>Vadim</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[MbUnit]]></category>
		<category><![CDATA[ReSharper]]></category>
		<category><![CDATA[VS2005]]></category>
		<category><![CDATA[VS2008]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://vkreynin.wordpress.com/2008/04/01/how-to-create-a-resharper-file-template/</guid>
		<description><![CDATA[ReSharper is a wonderful tool that makes writing code much easier.&#160; One of the features of this tool is ability to create templates.&#160; With ReSharper you can create Live, Surround With, and File Template.&#160; In this post I want to share with you how to create a File Template for MbUnit Test Fixture.
 After completion [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vkreynin.wordpress.com&blog=1150196&post=83&subd=vkreynin&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://www.jetbrains.com/resharper/index.html" target="_blank">ReSharper</a> is a wonderful tool that makes writing code much easier.&nbsp; One of the features of this tool is ability to create templates.&nbsp; With ReSharper you can create Live, Surround With, and File Template.&nbsp; In this post I want to share with you how to create a File Template for <a href="http://www.mbunit.com/" target="_blank">MbUnit</a> Test Fixture.</p>
<p><a href="http://vkreynin.files.wordpress.com/2008/04/mbtest-template-selection.png"><img style="border-width:0;" height="167" alt="MbTest Template Selection" src="http://vkreynin.files.wordpress.com/2008/04/mbtest-template-selection-thumb.png?w=244&#038;h=167" width="244" align="right" border="0"></a> After completion of this tutorial, you&#8217;ll be able to create an MbUnit Fixture by right clicking the test project and adding the test fixture. </p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<h3>Step 1: Open ReSharper &#8211; Options dialog.</h3>
<p>Start Visual Studio and from menu bar select ReSharper &#8211; Options (you also can get there by pressing Alt-R + O).</p>
<p><a href="http://vkreynin.files.wordpress.com/2008/04/resharper-options.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="444" alt="ReSharper_Options." src="http://vkreynin.files.wordpress.com/2008/04/resharper-options-thumb.png?w=444&#038;h=444" width="444" border="0"></a> </p>
<h3>Step 2: Create a new template.</h3>
<ul>
<li>In the left panel select File Templates under Templates section.
<li>Then select User Templates in Available templates.
<li>In this sample we&#8217;re going to create C# template, so select Class (C#) in Quick access list (it should be the first item in the list).
<li>Last click on Create Template icon <img style="border-width:0;" height="20" alt="ReSharper Create Template icon" src="http://vkreynin.files.wordpress.com/2008/04/resharper-create-template-icon.png?w=20&#038;h=20" width="20" border="0"> to see Edit Template dialog box.</li>
</ul>
<h3>Step 3: Create and save MbUnit Test Fixture template.</h3>
<ul>
<li>In <em>Name</em> text box enter MbUnit Fixture.&nbsp; It&#8217;s a name that will appear in the menu when you add a new test fixture.
<li>In <em>File name prefix</em> text box enter MbTest.&nbsp; It&#8217;s going to be a suggestion for your test file / class.</li>
</ul>
<p><a href="http://vkreynin.files.wordpress.com/2008/04/resharper-edit-template-general1.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="71" alt="ReSharper Edit Template General" src="http://vkreynin.files.wordpress.com/2008/04/resharper-edit-template-general-thumb1.png?w=426&#038;h=71" width="426" border="0"></a>&nbsp;</p>
<p><a href="http://vkreynin.files.wordpress.com/2008/04/resharper-template-options.png"><img style="border-width:0;" height="180" alt="ReSharper Template Options" src="http://vkreynin.files.wordpress.com/2008/04/resharper-template-options-thumb.png?w=244&#038;h=180" width="244" align="right" border="0"></a>Next click on <u>everywhere</u> link next to the word <em>Available</em> to see the Template Options dialog box.&nbsp; Select <em>Only in projects for language</em> radio button and chose <em>C# projects including ASP.NET C#projects)</em> from the drop-down control. <em>Extension for created files</em> leave as cs. </p>
<p>Now we are ready to create actual template.</p>
<p>Enter the code below into <em>Template text</em>.</p>
<div style="border-right:gray 1px solid;border-top:gray 1px solid;font-size:8pt;overflow:auto;border-left:gray 1px solid;width:97.5%;cursor:text;max-height:200px;line-height:12pt;border-bottom:gray 1px solid;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;margin:20px 0 10px;padding:4px;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;padding:0;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   1:</span> <span style="color:#0000ff;">using</span> MbUnit.Framework;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   2:</span>&nbsp; </pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   3:</span> <span style="color:#0000ff;">namespace</span> $NAMESPACE$</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   4:</span> {</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   5:</span>    [TestFixture]</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   6:</span>    [FixtureCategory(<span style="color:#006080;">"$CATEGORY$"</span>)]</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   7:</span>    [Author(<span style="color:#006080;">"Vadim Kreynin"</span>, <span style="color:#006080;">"Vadim@kreynin.com"</span>)]</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   8:</span>    <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> $CLASS$ {$END$}</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   9:</span> }</pre>
</div>
</div>
<p>I&#8217;m sure that you noticed $NAMESPACE$, $CATEGORY$, and $CLASS$.&nbsp; These three are ReSharper variables.&nbsp; You declare a variable by surrounding a word with $ sign.</p>
<p>The reason we created variables because we want to do something with them.</p>
<p>ReSharper has automatically created entries for our variables that looks like this:<a href="http://vkreynin.files.wordpress.com/2008/04/resharper-edit-template-variables1.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="151" alt="ReSharper Edit Template Variables" src="http://vkreynin.files.wordpress.com/2008/04/resharper-edit-template-variables-thumb1.png?w=422&#038;h=151" width="422" border="0"></a> </p>
<p>Click on <u>Choose macro</u> link and choose following options in Choose Macro dialog box.</p>
<table cellspacing="0" cellpadding="2" width="395" border="1">
<tbody>
<tr>
<td valign="top" width="100"><strong>Variable</strong></td>
<td valign="top" width="291"><strong>Available macro</strong></td>
</tr>
<tr>
<td valign="top" width="100">$NAMESPACE$</td>
<td valign="top" width="291">Default namespace for current file</td>
</tr>
<tr>
<td valign="top" width="100">$CATEGORY$</td>
<td valign="top" width="291">Constant value</td>
</tr>
<tr>
<td valign="top" width="100">$CLASS$</td>
<td valign="top" width="291">Current file name without extension</td>
</tr>
</tbody>
</table>
<p>Uncheck <em>Editable Occurrence</em> check box for NAMESPACE variable.</p>
<p>You can see that CATEGORY variable has a red link <u>Constant value</u>.&nbsp; Click on it and enter Category in <em>String value</em> text box of Choose Parameter Value dialog box.</p>
<p>You&#8217;re done!&nbsp; Click on OK button of Edit Template dialog box that should look like this: <a href="http://vkreynin.files.wordpress.com/2008/04/resharper-edit-template1.png"><img style="border-right:0;border-top:0;border-left:0;border-bottom:0;" height="462" alt="ReSharper Edit Template" src="http://vkreynin.files.wordpress.com/2008/04/resharper-edit-template-thumb1.png?w=440&#038;h=462" width="440" border="0"></a> </p>
<p>Now you can start using this template.</p>
<p>Next time I&#8217;ll show how to create a Live Template for tests, test SetUp(s) and TearDown(s).</p>
<p>&nbsp;</p>
<p><a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fvkreynin.wordpress.com%2f2008%2f04%2f01%2fhow-to-create-a-resharper-file-template%2f"><img alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fvkreynin.wordpress.com%2f2008%2f04%2f01%2fhow-to-create-a-resharper-file-template%2f" border="0"></a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vkreynin.wordpress.com/83/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vkreynin.wordpress.com/83/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vkreynin.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vkreynin.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vkreynin.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vkreynin.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vkreynin.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vkreynin.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vkreynin.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vkreynin.wordpress.com/83/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vkreynin.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vkreynin.wordpress.com/83/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vkreynin.wordpress.com&blog=1150196&post=83&subd=vkreynin&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vkreynin.wordpress.com/2008/04/01/how-to-create-a-resharper-file-template/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0bdbc8162336851af022196f897d6200?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vkreynin</media:title>
		</media:content>

		<media:content url="http://vkreynin.files.wordpress.com/2008/04/mbtest-template-selection-thumb.png" medium="image">
			<media:title type="html">MbTest Template Selection</media:title>
		</media:content>

		<media:content url="http://vkreynin.files.wordpress.com/2008/04/resharper-options-thumb.png" medium="image">
			<media:title type="html">ReSharper_Options.</media:title>
		</media:content>

		<media:content url="http://vkreynin.files.wordpress.com/2008/04/resharper-create-template-icon.png" medium="image">
			<media:title type="html">ReSharper Create Template icon</media:title>
		</media:content>

		<media:content url="http://vkreynin.files.wordpress.com/2008/04/resharper-edit-template-general-thumb1.png" medium="image">
			<media:title type="html">ReSharper Edit Template General</media:title>
		</media:content>

		<media:content url="http://vkreynin.files.wordpress.com/2008/04/resharper-template-options-thumb.png" medium="image">
			<media:title type="html">ReSharper Template Options</media:title>
		</media:content>

		<media:content url="http://vkreynin.files.wordpress.com/2008/04/resharper-edit-template-variables-thumb1.png" medium="image">
			<media:title type="html">ReSharper Edit Template Variables</media:title>
		</media:content>

		<media:content url="http://vkreynin.files.wordpress.com/2008/04/resharper-edit-template-thumb1.png" medium="image">
			<media:title type="html">ReSharper Edit Template</media:title>
		</media:content>

		<media:content url="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fvkreynin.wordpress.com%2f2008%2f04%2f01%2fhow-to-create-a-resharper-file-template%2f" medium="image">
			<media:title type="html">kick it on DotNetKicks.com</media:title>
		</media:content>
	</item>
		<item>
		<title>Copy and Paste in Visual Studio and MS SQL Server Management Studio.</title>
		<link>http://vkreynin.wordpress.com/2007/03/21/copy-and-paste-in-visual-studio-and-ms-sql-server-managment-studio/</link>
		<comments>http://vkreynin.wordpress.com/2007/03/21/copy-and-paste-in-visual-studio-and-ms-sql-server-managment-studio/#comments</comments>
		<pubDate>Wed, 21 Mar 2007 13:37:00 +0000</pubDate>
		<dc:creator>Vadim</dc:creator>
				<category><![CDATA[Tips And Tricks]]></category>
		<category><![CDATA[VS2005]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://vkreynin.wordpress.com/2007/03/21/copy-and-paste-in-visual-studio-and-ms-sql-server-managment-studio/</guid>
		<description><![CDATA[I realized that many people don’t know how easy Visual Studio or SQL Server Management Studio allows us to copy, cut &#38; paste. I’m sure that many of you know that but if you don’t, please give it try I’m sure that you’ll save some time.
Even my mother knows Ctrl-C, Ctrl-X, &#38; Ctrl-V shortcuts to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vkreynin.wordpress.com&blog=1150196&post=9&subd=vkreynin&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I realized that many people don’t know how easy Visual Studio or SQL Server Management Studio allows us to copy, cut &amp; paste. I’m sure that many of you know that but if you don’t, please give it try I’m sure that you’ll save some time.</p>
<p>Even my mother knows Ctrl-C, Ctrl-X, &amp; Ctrl-V shortcuts to copy, cut, &amp; paste. But do you know that you don’t need to select a line to copy/cut it. Just move cursor to the line you want to copy/cut and press Ctrl-C or Ctrl-X, the whole line will be copied into the clipboard.<br />
We copied a line, now we can paste it. The line always will be posted above the line where you cursor is. And you cursor can be in any position on that line; I repeat ANY position of the line.<br />
Do you know that you can cycle through the <a title="Using the Clipboard Ring" href="http://msdn.microsoft.com/en-us/library/aa301782(VS.71).aspx" target="_blank">clipboard ring</a>? Here’s the example where we are going to swap ‘var1’ and ‘var2’ words:</p>
<p><code>public void foo()<br />
{<br />
string s1 = "var1";<br />
string s2 = "var2"<br />
}<br />
</code></p>
<ul>
<li>First double click on word ‘var1’, to select it and then press Ctrl-C, to put the selection into the clipboard.</li>
<li>Next double click on word ‘var2 and press Ctrl-C again. Now we have both selections in the clipboard.</li>
<li>Now double click on word ‘var1’ again and replace it with ‘var2’ by pressing Ctrl-V. So far nothing new.</li>
<li>Last, double click on word ‘var2’ on the next line where we’re declaring variable s2 and press Ctrl-Shift-V twice (it means two times :) ).</li>
</ul>
<p><a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fvkreynin.wordpress.com%2f2007%2f03%2f21%2fcopy-and-paste-in-visual-studio-and-ms-sql-server-managment-studio%2f"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fvkreynin.wordpress.com%2f2007%2f03%2f21%2fcopy-and-paste-in-visual-studio-and-ms-sql-server-managment-studio%2f" border="0" alt="kick it on DotNetKicks.com" /></a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vkreynin.wordpress.com/9/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vkreynin.wordpress.com/9/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vkreynin.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vkreynin.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vkreynin.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vkreynin.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vkreynin.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vkreynin.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vkreynin.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vkreynin.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vkreynin.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vkreynin.wordpress.com/9/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vkreynin.wordpress.com&blog=1150196&post=9&subd=vkreynin&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vkreynin.wordpress.com/2007/03/21/copy-and-paste-in-visual-studio-and-ms-sql-server-managment-studio/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0bdbc8162336851af022196f897d6200?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vkreynin</media:title>
		</media:content>

		<media:content url="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fvkreynin.wordpress.com%2f2007%2f03%2f21%2fcopy-and-paste-in-visual-studio-and-ms-sql-server-managment-studio%2f" medium="image">
			<media:title type="html">kick it on DotNetKicks.com</media:title>
		</media:content>
	</item>
	</channel>
</rss>