<?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>DevInstance &#187; Visual Studio 2005</title>
	<atom:link href="http://devinstance.wordpress.com/category/visual-studio-2005/feed/" rel="self" type="application/rss+xml" />
	<link>http://devinstance.wordpress.com</link>
	<description>Life should taste as good as it</description>
	<lastBuildDate>Sun, 22 Oct 2006 00:35:54 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='devinstance.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/be87a03a47749519ecccb6a1ae6bfe05?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>DevInstance &#187; Visual Studio 2005</title>
		<link>http://devinstance.wordpress.com</link>
	</image>
			<item>
		<title>Finding references in Visual Studio &#8211; an annoying behavior</title>
		<link>http://devinstance.wordpress.com/2006/08/27/finding-references-in-visual-studio-an-annoying-problem/</link>
		<comments>http://devinstance.wordpress.com/2006/08/27/finding-references-in-visual-studio-an-annoying-problem/#comments</comments>
		<pubDate>Sun, 27 Aug 2006 22:20:04 +0000</pubDate>
		<dc:creator>Ernani</dc:creator>
				<category><![CDATA[Reviews]]></category>
		<category><![CDATA[Visual Studio 2005]]></category>

		<guid isPermaLink="false">http://devinstance.wordpress.com/2006/08/27/finding-references-in-visual-studio-an-annoying-problem/</guid>
		<description><![CDATA[A good tool from Visual Studio 2005 is the &#8220;Find all references&#8221; in the context menu. However, it has a annoying behavior in a common situation within my project.
Suppose I have the A, B and C classes that implements the I interface, and that interface has declared a method named &#8220;save&#8221;. Now, I want to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devinstance.wordpress.com&blog=351411&post=10&subd=devinstance&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>A good tool from Visual Studio 2005 is the &#8220;Find all references&#8221; in the context menu. However, it has a annoying behavior in a common situation within my <a href="http://devinstance.wordpress.com/2006/08/12/dot-net-hungry/">project</a>.</p>
<p>Suppose I have the A, B and C classes that implements the I interface, and that interface has declared a method named &#8220;save&#8221;. Now, I want to know where in my code the method C.save() is called, and&nbsp;usually I would right-click the method name in the method definition at the C class and use the &#8220;Find all references&#8221; tool. However, if I do this, the Visual Studio tool will find all the references of any &#8220;save()&#8221; method of the project, even of the A or B classes.</p>
<p>The best behavior of this tool would be finding only the references of the &#8220;save()&#8221; method called from instances of the C class.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/devinstance.wordpress.com/10/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/devinstance.wordpress.com/10/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/devinstance.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/devinstance.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/devinstance.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/devinstance.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/devinstance.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/devinstance.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/devinstance.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/devinstance.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/devinstance.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/devinstance.wordpress.com/10/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devinstance.wordpress.com&blog=351411&post=10&subd=devinstance&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://devinstance.wordpress.com/2006/08/27/finding-references-in-visual-studio-an-annoying-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/dffcf27d68fef1ecf1a9d57fd4021e16?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Ernani</media:title>
		</media:content>
	</item>
		<item>
		<title>Refactoring with Visual Studio 2005</title>
		<link>http://devinstance.wordpress.com/2006/08/15/refactoring-with-visual-studio-2005/</link>
		<comments>http://devinstance.wordpress.com/2006/08/15/refactoring-with-visual-studio-2005/#comments</comments>
		<pubDate>Tue, 15 Aug 2006 15:11:25 +0000</pubDate>
		<dc:creator>Ernani</dc:creator>
				<category><![CDATA[Refactoring]]></category>
		<category><![CDATA[Reviews]]></category>
		<category><![CDATA[Visual Studio 2005]]></category>

		<guid isPermaLink="false">https://devinstance.wordpress.com/2006/08/15/refactoring-with-visual-studio-2005/</guid>
		<description><![CDATA[I have started worrying about systems maintenance while working on my first BIG project, a virtual &#8220;classroom&#8221; for an e-learning solution. A great idea when dealing with this subject is to know more about refactoring, a technique that lets you change your code (with the purpose of getting it more simple or easier to understand) [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devinstance.wordpress.com&blog=351411&post=5&subd=devinstance&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I have started worrying about systems maintenance while working on my first BIG project, a virtual &#8220;classroom&#8221; for an e-learning solution. A great idea when dealing with this subject is to know more about <a target="_blank" href="http://www.refactoring.com/">refactoring</a>, a technique that lets you change your code (with the purpose of getting it more simple or easier to understand) without changing its external behavior. The refactoring discipline has some common techniques that are well known like the &#8220;extract method&#8221;, that consists on identifying a source code snippet that is commonly used along the software and put it inside a new method.</p>
<p>The Visual Studio 2005 has the new &#8220;Refactor&#8221; feature, that help us implement some of the most used refactoring techniques. It is very simple to use: all you need to do is select the part of the code that you want to refactor and right-click and select the &#8220;refactor&#8221; submenu. This is shown below:</p>
<p align="center"><img width="128" src="http://devinstance.files.wordpress.com/2006/08/1.thumbnail.JPG?w=128&#038;h=93" alt="Refactor submenu" height="93" /></p>
<p>I think I don&#8217;t need to talk about renaming =) But this is very useful, much better than the old find-and-replace way.</p>
<p>You can use the <strong>extract method</strong> refactoring when you have a code snippet that is commonly used along the software code, resulting in duplicated logic. All you need to do is select the part of the code that represents this snippet and right-click selecting the Refactor &gt;&gt; Extract Method option. Then you define a name for the new method and click OK. You must take care about some issues:</p>
<ol>
<li>If the code snippet is used elsewhere, you will have to go there and change the code manually do use the new method.</li>
<li>Visual Studio will pass the scope variables used by the code snipped automatically to the new method. So, it&#8217;s a good practice to be more careful with side effects dealing with these variables, specially if the method will be used somewhere else.</li>
</ol>
<p>The <strong>encapsulate field</strong> option generates code for the get and set handlers of a given class field. This is useful, but would be better if the generated code was placed in a default #region snippet, resulting in a well organized code.</p>
<p>Look at the code below.</p>
<p><font size="2" color="#0000ff">public</font> <font size="2" color="#0000ff">class</font><font size="2"> </font><font size="2" color="#008080">Car</font><br />
{<br />
   <font size="2" color="#0000ff">private</font> <font size="2" color="#0000ff">int</font><font size="2"> power;</font><br />
   <font size="2" color="#0000ff">private</font> <font size="2" color="#0000ff">string</font><font size="2"> model;</font><br />
   <font size="2" color="#0000ff">private</font> <font size="2" color="#0000ff">string</font><font size="2"> manufacturer;</font><br />
}</p>
<p>If we right click at each field and select Refactor &gt;&gt; Encapsulate field, the result will be this:</p>
<p><font size="2" color="#0000ff">public</font> <font size="2" color="#0000ff">class</font><font size="2"> </font><font size="2" color="#008080">Car</font><br />
{<br />
   <font size="2" color="#0000ff">private</font> <font size="2" color="#0000ff">int</font><font size="2"> power;</font></p>
<p>   <font size="2" color="#0000ff">public</font> <font size="2" color="#0000ff">int</font><font size="2"> Power</font><br />
   {<br />
      <font size="2" color="#0000ff">get</font> { <font size="2" color="#0000ff">return</font><font size="2"> power;</font> }<br />
      <font size="2" color="#0000ff">set</font> { <font size="2">power = </font><font size="2" color="#0000ff">value</font>; }<br />
   }<br />
   <font size="2" color="#0000ff">private</font> <font size="2" color="#0000ff">string</font><font size="2"> model;</font></p>
<p>   <font size="2" color="#0000ff">public</font> <font size="2" color="#0000ff">string</font><font size="2"> Model</font><br />
   {<br />
      <font size="2" color="#0000ff">get</font> { <font size="2" color="#0000ff">return</font><font size="2"> model;</font> }<br />
      <font size="2" color="#0000ff">set</font> { <font size="2">model = </font><font size="2" color="#0000ff">value</font>; }<br />
   }<br />
   <font size="2" color="#0000ff">private</font> <font size="2" color="#0000ff">string</font><font size="2"> manufacturer;</font></p>
<p>   <font size="2" color="#0000ff">public</font> <font size="2" color="#0000ff">string</font><font size="2"> Manufacturer</font><br />
   {<br />
      <font size="2" color="#0000ff">get</font> { <font size="2" color="#0000ff">return</font><font size="2"> manufacturer;</font> }<br />
      <font size="2" color="#0000ff">set</font> { <font size="2">manufacturer = </font><font size="2" color="#0000ff">value</font>; }<br />
   }<br />
}</p>
<p>However, the code does not look good&#8230; It would be better if the generated code looked something like this:</p>
<p><font size="2" color="#0000ff">public</font> <font size="2" color="#0000ff">class</font><font size="2"> </font><font size="2" color="#008080">Car</font><br />
{<br />
   <font size="2" color="#0000ff">private</font> <font size="2" color="#0000ff">int</font><font size="2"> power;</font><br />
   <font size="2" color="#0000ff">private</font> <font size="2" color="#0000ff">string</font><font size="2"> model;</font><br />
   <font size="2" color="#0000ff">private</font> <font size="2" color="#0000ff">string</font><font size="2"> manufacturer;</font></p>
<p>   <font size="2" color="#0000ff">#region</font> <font size="2">Field access methods</font><br />
   <font size="2" color="#0000ff">public</font> <font size="2" color="#0000ff">int</font><font size="2"> Power</font><br />
   {<br />
      <font size="2" color="#0000ff">get</font> { <font size="2" color="#0000ff">return</font><font size="2"> power;</font> }<br />
      <font size="2" color="#0000ff">set</font> { <font size="2">power = </font><font size="2" color="#0000ff">value</font>; }<br />
   }<br />
   <font size="2" color="#0000ff">public</font> <font size="2" color="#0000ff">string</font><font size="2"> Model</font><br />
   {<br />
      <font size="2" color="#0000ff">get</font> { <font size="2" color="#0000ff">return</font><font size="2"> model;</font> }<br />
      <font size="2" color="#0000ff">set</font> { <font size="2">model = </font><font size="2" color="#0000ff">value</font>; }<br />
   }<br />
   <font size="2" color="#0000ff">public</font> <font size="2" color="#0000ff">string</font><font size="2"> Manufacturer</font><br />
   {<br />
      <font size="2" color="#0000ff">get</font> { <font size="2" color="#0000ff">return</font><font size="2"> manufacturer;</font> }<br />
      <font size="2" color="#0000ff">set</font> { <font size="2">manufacturer = </font><font size="2" color="#0000ff">value</font>; }<br />
   }<br />
   <font size="2" color="#0000ff">#endregionregion</font><br />
}</p>
<p>I did not use the other options of the Refactor submenu, but as soon as I use them I&#8217;ll post something about.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/devinstance.wordpress.com/5/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/devinstance.wordpress.com/5/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/devinstance.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/devinstance.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/devinstance.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/devinstance.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/devinstance.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/devinstance.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/devinstance.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/devinstance.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/devinstance.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/devinstance.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=devinstance.wordpress.com&blog=351411&post=5&subd=devinstance&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://devinstance.wordpress.com/2006/08/15/refactoring-with-visual-studio-2005/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/dffcf27d68fef1ecf1a9d57fd4021e16?s=96&#38;d=identicon" medium="image">
			<media:title type="html">Ernani</media:title>
		</media:content>

		<media:content url="http://devinstance.files.wordpress.com/2006/08/1.thumbnail.JPG" medium="image">
			<media:title type="html">Refactor submenu</media:title>
		</media:content>
	</item>
	</channel>
</rss>