<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/1.5" -->
<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/"
>

<channel>
	<title>JetBrains .NET Tools Blog</title>
	<link>http://blogs.jetbrains.com/dotnet</link>
	<description>tips&#038;tricks, news, how-to's</description>
	<pubDate>Mon, 05 May 2008 20:21:10 +0000</pubDate>
	<generator>http://wordpress.org/?v=1.5</generator>
	<language>en</language>

		<item>
		<title>dotTrace 3.1 is Released!</title>
		<link>http://blogs.jetbrains.com/dotnet/2008/05/dottrace-31-is-released/</link>
		<comments>http://blogs.jetbrains.com/dotnet/2008/05/dottrace-31-is-released/#comments</comments>
		<pubDate>Mon, 05 May 2008 23:20:19 +0000</pubDate>
		<dc:creator>Jura Gorohovsky</dc:creator>
		
	<category>News and Events</category>
		<guid>http://blogs.jetbrains.com/dotnet/2008/05/dottrace-31-is-released/</guid>
		<description><![CDATA[JetBrains announces dotTrace 3.1]]></description>
			<content:encoded><![CDATA[	<p>JetBrains announces dotTrace 3.1 - the new minor release of the simple and super-fast profiling tool for .NET developers!<br />
&nbsp;<br />
We keep working on a major upgrade that will represent a big step in terms of functionality and scalability, but as an intermediate release, we&#8217;d like to introduce dotTrace 3.1. The highlights of this new version include:<br />
&nbsp;</p>
	<ul>
	<li>Support for Visual Studio 2008 and .NET Framework 3.x. You can now launch dotTrace from Visual Studio 2008 and profile solutions running under latest versions of .NET Framework.</li>
	<li>Support for Windows Vista and Windows Server 2008.</li>
	<li>Support for web-based JetBrains License Server, a utility that serves as a central source of license tickets and distributes them between workstations seamlessly.</li>
	<li>A new floating license that any member of your development team can use.</li>
	<li>Stability and performance improvements.</li>
	</ul>
	<p>&nbsp;<br />
As usual, you can <a href="http://www.jetbrains.com/profiler/download/index.html">download a 10-day evaluation copy</a>. Current dotTrace 3.0 customers can upgrade for free.<br />
&nbsp;<br />
For more details on changes in dotTrace 3.1 as compared to 3.0, see <a href="http://www.jetbrains.com/profiler/download/releaseNotes31.html">Release Notes</a>.</p>
	<div style="font-size: 10px; margin-top: 25px;">Technorati tags: <a href="http://www.technorati.com/tag/dotTrace" rel="tag">dotTrace</a>, <a href="http://www.technorati.com/tag/dotTrace+3.1" rel="tag">dotTrace 3.1</a>, <a href="http://www.technorati.com/tag/release" rel="tag">release</a></div>
]]></content:encoded>
			<wfw:commentRSS>http://blogs.jetbrains.com/dotnet/2008/05/dottrace-31-is-released/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>ReSharper in Detail: Code Completion in ReSharper 4.0</title>
		<link>http://blogs.jetbrains.com/dotnet/2008/05/resharper-in-detail-code-completion/</link>
		<comments>http://blogs.jetbrains.com/dotnet/2008/05/resharper-in-detail-code-completion/#comments</comments>
		<pubDate>Sun, 04 May 2008 17:07:29 +0000</pubDate>
		<dc:creator>Jura Gorohovsky</dc:creator>
		
	<category>News and Events</category>
		<guid>http://blogs.jetbrains.com/dotnet/2008/05/resharper-in-detail-code-completion/</guid>
		<description><![CDATA[ReSharper's Code Completion: how it is different from Visual Studio's IntelliSense and from what it's been in the past. Symbol Completion, Smart Completion and Import Symbol Completion. ]]></description>
			<content:encoded><![CDATA[	<p>ReSharper extends Visual Studio&#8217;s native IntelliSense with a set of three Code Completion features to make it more convenient and adaptable.<br />
&nbsp;<br />
ReSharper’s Code Completion is a natural candidate for in-detail review. However, a full-fledged description is out of agenda, because Ilya Ryzhenkov&#8217;s <a href="http://resharper.blogspot.com/2007/05/code-completion-with-resharper.html">Code Completion with ReSharper</a> says it all. Or does it?<br />
&nbsp;<br />
While his post is comprehensive, it was written back when R# 3.0 EAP was far from being complete. That said, a number of corrections and additions are due to be announced as of late R# 4.0 EAP.<br />
&nbsp;</p>
	<ul>
	<li>There are still three Completion features, but what was previously known as Basic Completion is now called <em>Symbol Completion</em>, while Type Name Completion was renamed to <em>Import Symbol Completion</em>.</li>
	<li>In ReSharper 4.0, all three completion features support <a href="http://blogs.jetbrains.com/dotnet/2008/02/resharper-in-detail-camelhumps/">CamelHumps</a> - for example, you can complete a long type name by entering only its uppercase characters (can you say <em>&#8220;DecoderReplacementFallbackBuffer&#8221;</em>? forget it - just type <em>DRFB</em> instead)<br />
 To make sure it works, clear the <strong>Case-sensitive prefix matching</strong> check box in <strong>Resharper | Options | Environment | IntelliSense | Completion Behavior</strong>. Note that the <strong>Use CamelHumps</strong> check box in <strong>ReSharper | Options | Environment | Editor</strong> doesn&#8217;t have any impact on how CamelHumps works in completion.</li>
	<li>Needless to say, Code Completion as of R# 4.0 supports C# 3.0 features, including:
	<ul>
	<li><em>Extension methods</em>. Both Smart Completion and Symbol Completion are enabled to suggest extension methods. Import Symbol Completion works after dot for extension methods and inserts required using directives:<br />
<img src='http://blogs.jetbrains.com/dotnet/wp-content/img/extension_methods_import_symbol_01.png' alt='' /></li>
	<li><em>Object and collection initializers</em>. Smart Completion in initializers displays available properties/fields to initialize:<br />
<img src='http://blogs.jetbrains.com/dotnet/wp-content/img/object_initializers_smart.png' alt='' /></li>
	<li><em>Lambdas</em>. Smart Completion generates lambda-expression syntax as an alternative for anonymous and named methods:<br />
<img src='http://blogs.jetbrains.com/dotnet/wp-content/img/labdas_smart.png' alt='' />
</li>
	</ul>
</li>
	<li><em>Complete Statement</em>. Complete Statement is a feature that inserts necessary syntax elements with a simple shortcut - <strong>Ctrl+Shift+Enter</strong>. It comes to the rescue in numerous situations, including auto-closing parentheses, adding semicolons, completing <em>if</em>, <em>while</em> and <em>for</em> statements, declaring classes, methods, and structs, and so on:<br />
<img src='http://blogs.jetbrains.com/dotnet/wp-content/img/complete_statement_2.png' alt='' />
</li>
	<li>There are also some minor changes and fixes, including completion for boolean fields in XAML files, auto-inserting closing single quotes in XML attributes, and so forth.
</li>
	</ul>
	<p>&nbsp;<br />
<strong>Additional references</strong></p>
	<ul>
	<li><a href="http://resharper.blogspot.com/2007/05/code-completion-with-resharper.html">ReSharper Horizons: Code Completion with ReSharper</a></li>
	<li><a href="http://blogs.jetbrains.com/nocturne/archives/000039.html">Oleg Stepanov&#8217;s Weblog: Code Completion Illustrated, Part I. Basic Completion</a> (attention! this one is antique!)</li>
	<li><a href="http://www.jetbrains.net/confluence/display/ReSharper/ReSharper+4.0+EAP+Notes">ReSharper 4.0 EAP Notes</a></li>
	</ul>
	<div style="font-size: 10px; margin-top: 25px;">Technorati tags: <a href="http://www.technorati.com/tag/ReSharper" rel="tag">ReSharper</a>, <a href="http://www.technorati.com/tag/ReSharper+in+Detail" rel="tag">ReSharper in Detail</a>, <a href="http://www.technorati.com/tag/Code+Completion" rel="tag">Code Completion</a>, <a href="http://www.technorati.com/tag/CamelHumps" rel="tag">CamelHumps</a>, <a href="http://www.technorati.com/tag/ReSharper+4.0" rel="tag">ReSharper 4.0</a></div>
]]></content:encoded>
			<wfw:commentRSS>http://blogs.jetbrains.com/dotnet/2008/05/resharper-in-detail-code-completion/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>JetBrains Development Academy To Serve the Community</title>
		<link>http://blogs.jetbrains.com/dotnet/2008/04/jetbrains-development-academy/</link>
		<comments>http://blogs.jetbrains.com/dotnet/2008/04/jetbrains-development-academy/#comments</comments>
		<pubDate>Wed, 30 Apr 2008 19:03:58 +0000</pubDate>
		<dc:creator>Jura Gorohovsky</dc:creator>
		
	<category>Other</category>
	<category>News and Events</category>
		<guid>http://blogs.jetbrains.com/dotnet/2008/04/jetbrains-development-academy/</guid>
		<description><![CDATA[JetBrains Development Academy: fostering a community of experts and evangelists to champion best development practices and promote software innovation worldwide]]></description>
			<content:encoded><![CDATA[	<p>You might have already heard about the brand new JetBrains Development Academy. Launched in April 2008, the Academy fosters a community of experts and evangelists to champion best development practices and promote software innovation worldwide.<br />
&nbsp;<br />
The JetBrains Development Academy serves as a connection point for developers who strive to adopt top methodologies and use JetBrains products to help them achieve that goal. It plans to provide support for Java and .NET user groups, support educational institutions, conduct in-place presentations, publish articles on the <a href="http://www.jetbrains.com/devnet/index.html">Academy&#8217;s website</a>, and help users learn about popular and innovative technologies. These benefits will be provided courtesy of the Academy members, who are recognized experts representing various areas of software development.<br />
&nbsp;<br />
The Academy website also features a <a href="http://www.jetbrains.com/devnet/questions/index.html">Q&#038;A section</a>, where you can ask questions, get answers and gain valuable insight into the technologies, products and best practices relevant in today&#8217;s world of software development.</p>
	<div style="font-size: 10px; margin-top: 25px;">Technorati tags: <a href="http://www.technorati.com/tag/JetBrains" rel="tag">JetBrains</a>, <a href="http://www.technorati.com/tag/JetBrains+Development+Academy" rel="tag">JetBrains Development Academy</a></div>
]]></content:encoded>
			<wfw:commentRSS>http://blogs.jetbrains.com/dotnet/2008/04/jetbrains-development-academy/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>Generating object initializers with ReSharper</title>
		<link>http://blogs.jetbrains.com/dotnet/2008/04/generating-object-initializers-with-resharper/</link>
		<comments>http://blogs.jetbrains.com/dotnet/2008/04/generating-object-initializers-with-resharper/#comments</comments>
		<pubDate>Fri, 11 Apr 2008 17:22:15 +0000</pubDate>
		<dc:creator>Jura Gorohovsky</dc:creator>
		
	<category>ReSharper Tips&#038;Tricks</category>
	<category>How-To's</category>
		<guid>http://blogs.jetbrains.com/dotnet/2008/04/generating-object-initializers-with-resharper/</guid>
		<description><![CDATA[How to generate object initializers in two different ways using ReSharper]]></description>
			<content:encoded><![CDATA[	<p>ReSharper provides both a quick-fix and a context action to transform assignment statements into C# object initializers, and both are called &#8220;Use object initializer&#8221;.<br />
&nbsp;<br />
So what&#8217;s the difference between them?<br />
&nbsp;<br />
Suppose that you create an object with three assignment statements:<br />
&nbsp;<br />
<img src='http://blogs.jetbrains.com/dotnet/wp-content/img/01.png' alt='' /><br />
&nbsp;<br />
Putting the caret over the &#8220;new&#8221; keyword lets you apply a <em>quick-fix</em> that <em>will put all assigned fields into an object initializer</em>:<br />
&nbsp;<br />
<img src='http://blogs.jetbrains.com/dotnet/wp-content/img/02.png' alt='' /><br />
&nbsp;<br />
Putting the caret over the object variable or a field name in any of the tree assignment statements lets you apply a context action that will put only this assignment in the object initializer:<br />
&nbsp;<br />
<img src='http://blogs.jetbrains.com/dotnet/wp-content/img/03.png' alt='' /><br />
&nbsp;<br />
That is, <em>using the context action, you can selectively put field assignments into the object initializer</em>, leaving some of them to be declared explicitly.</p>
	<div style="font-size: 10px; margin-top: 25px;">Technorati tags: <a href="http://www.technorati.com/tag/ReSharper" rel="tag">ReSharper</a>, <a href="http://www.technorati.com/tag/ReSharper+4.0" rel="tag">ReSharper 4.0</a>, <a href="http://www.technorati.com/tag/object+initializers" rel="tag">object initializers</a>, <a href="http://www.technorati.com/tag/quick-fixes" rel="tag">quick-fixes</a>, <a href="http://www.technorati.com/tag/context+actions" rel="tag">context actions</a></div>
]]></content:encoded>
			<wfw:commentRSS>http://blogs.jetbrains.com/dotnet/2008/04/generating-object-initializers-with-resharper/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>Feedback received</title>
		<link>http://blogs.jetbrains.com/dotnet/2008/04/feedback-received/</link>
		<comments>http://blogs.jetbrains.com/dotnet/2008/04/feedback-received/#comments</comments>
		<pubDate>Fri, 11 Apr 2008 15:19:59 +0000</pubDate>
		<dc:creator>Jura Gorohovsky</dc:creator>
		
	<category>Other</category>
	<category>Links and Opinions</category>
		<guid>http://blogs.jetbrains.com/dotnet/2008/04/feedback-received/</guid>
		<description><![CDATA[Thanks for sharing your thoughts and demands in the previous post. Your input will hopefully push us to pay more attention to screencasting in the near future.
&nbsp;
Meanwhile, in case that you've missed it, take a look at our existing collection of demos. ]]></description>
			<content:encoded><![CDATA[	<p>Thanks for sharing your thoughts and demands in the <a href="http://blogs.jetbrains.com/dotnet/2008/04/feedback-wanted/">previous post</a>. Your input will hopefully push us to pay more attention to screencasting in the near future.<br />
&nbsp;<br />
Meanwhile, in case that you&#8217;ve missed it, take a look at our existing <a href="http://www.jetbrains.com/resharper/documentation/index.html">collection of demos</a>.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://blogs.jetbrains.com/dotnet/2008/04/feedback-received/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>Feedback wanted</title>
		<link>http://blogs.jetbrains.com/dotnet/2008/04/feedback-wanted/</link>
		<comments>http://blogs.jetbrains.com/dotnet/2008/04/feedback-wanted/#comments</comments>
		<pubDate>Mon, 07 Apr 2008 15:21:35 +0000</pubDate>
		<dc:creator>Jura Gorohovsky</dc:creator>
		
	<category>Other</category>
	<category>Links and Opinions</category>
		<guid>http://blogs.jetbrains.com/dotnet/2008/04/feedback-wanted/</guid>
		<description><![CDATA[This post serves to gather feedback regarding any particular ReSharper features that you'd like to see reviewed in this blog.
Please have your say!

Updated! This post is not a place to suggest new features/improvements for whatever version of ReSharper. The most efficient way to do it is using JIRA. ]]></description>
			<content:encoded><![CDATA[	<p>This post serves to gather feedback regarding any particular ReSharper <strong>features that you&#8217;d like to see reviewed in this blog</strong>.<br />
Please have your say!</p>
	<p>Updated! This post is not a place to suggest new features/improvements for whatever version of ReSharper. The most efficient way to do it is using <a href="http://www.jetbrains.net/jira/">JIRA</a>.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://blogs.jetbrains.com/dotnet/2008/04/feedback-wanted/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>ReSharper in Detail: Hints - a New Level of Code Inspection in ReSharper 4.0</title>
		<link>http://blogs.jetbrains.com/dotnet/2008/04/hints-a-new-level-of-code-inspection-in-resharper-40/</link>
		<comments>http://blogs.jetbrains.com/dotnet/2008/04/hints-a-new-level-of-code-inspection-in-resharper-40/#comments</comments>
		<pubDate>Thu, 03 Apr 2008 19:43:55 +0000</pubDate>
		<dc:creator>Jura Gorohovsky</dc:creator>
		
	<category>News and Events</category>
		<guid>http://blogs.jetbrains.com/dotnet/2008/04/hints-a-new-level-of-code-inspection-in-resharper-40/</guid>
		<description><![CDATA[Hints: a new level of code inspection in ReSharper 4.0]]></description>
			<content:encoded><![CDATA[	<p>Until recently (that is, until R# 4.0 nightly builds became available), ReSharper had three levels of code analysis:<br />
&nbsp;</p>
	<ul>
	<li>Errors (to highlight uncompilable code)</li>
	<li>Warnings (to mark code items that don&#8217;t prevent your code from compiling but may nevertheless represent serious coding inefficiencies)</li>
	<li>Suggestions (to draw your attention to things that are not necessarily wrong but useful to know)</li>
	</ul>
	<p>&nbsp;<br />
R# 4.0 introduces a new, considerably less intrusive level of code analysis results - <strong>hints</strong>.<br />
&nbsp;<br />
Unlike errors, warnings and suggestions, hints are not taken into account when you navigate to next/previous highlights, not shown in the Marker Bar and therefore do not influence the color of the Status Indicator. A hint simply brings your attention to a particular code detail and recommends a way of improvement. Code items that have associated hints are highlighted with a solid green underline. Move the mouse pointer over a highlighted item to view the corresponding hint in a tooltip:<br />
&nbsp;<br />
<img src='http://blogs.jetbrains.com/dotnet/wp-content/img/Code_Analysis__Code_Highlighting__Hints__1_02.png' alt='' /><br />
&nbsp;<br />
Putting the caret at a highlighted item allows you to display the hint in the status bar.<br />
&nbsp;<br />
As usual, for any code inspection item that is shown as a hint by default, you can modify inspection severity to display it as a suggestion, error or warning. You can do that in one of the two alternative ways:<br />
&nbsp;</p>
	<ul>
	<li>using the general list of code inspection items in <strong>ReSharper | Options | Code Inspection | Inspection Severity</strong>, or</li>
	<li>using an item-specific <strong>Inspection options</strong> dialog box (which is new in ReSharper 4.0, by the way) that you can open by <strong>Alt+Enter</strong>ing a specific hint and choosing <strong>Inspection options for [name of inspection item]</strong> in the drop-down list.</li>
	</ul>
	<p>&nbsp;<br />
In practice, hints turned out to be a convenient way for ReSharper to suggest migrating to C# 3.0 features without disturbing your coding sessions too much. That&#8217;s a reason why they&#8217;re somewhat left out of ReSharper&#8217;s traditional &#8220;show code highlights and let user navigate between them&#8221; routine.</p>
	<div style="font-size: 10px; margin-top: 25px;">Technorati tags: <a href="http://www.technorati.com/tag/ReSharper+in+Detail" rel="tag">ReSharper in Detail</a>, <a href="http://www.technorati.com/tag/ReSharper" rel="tag">ReSharper</a>, <a href="http://www.technorati.com/tag/ReSharper+4.0" rel="tag">ReSharper 4.0</a>, <a href="http://www.technorati.com/tag/hints" rel="tag">hints</a>, <a href="http://www.technorati.com/tag/code+analysis" rel="tag">code analysis</a>, <a href="http://www.technorati.com/tag/code+inspection" rel="tag">code inspection</a></div>
]]></content:encoded>
			<wfw:commentRSS>http://blogs.jetbrains.com/dotnet/2008/04/hints-a-new-level-of-code-inspection-in-resharper-40/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>ReSharper 3.1 vs Plain Visual Studio</title>
		<link>http://blogs.jetbrains.com/dotnet/2008/03/resharper-31-vs-visual-studio/</link>
		<comments>http://blogs.jetbrains.com/dotnet/2008/03/resharper-31-vs-visual-studio/#comments</comments>
		<pubDate>Tue, 25 Mar 2008 19:39:38 +0000</pubDate>
		<dc:creator>Jura Gorohovsky</dc:creator>
		
	<category>Links and Opinions</category>
	<category>ReSharper Tips&#038;Tricks</category>
		<guid>http://blogs.jetbrains.com/dotnet/2008/03/resharper-31-vs-visual-studio/</guid>
		<description><![CDATA[A clear comparison table that illustrates how exactly ReSharper complements the functionality of Visual Studio]]></description>
			<content:encoded><![CDATA[	<p>Personally, I&#8217;ve been a fan of comparison tables for ages, and now there&#8217;s one that hits the nail on the head!<br />
&nbsp;<br />
Ladies and gentlemen, please welcome <a href="http://www.jetbrains.com/resharper/features/ComparisonMatrix.html"><font color="red">ReSharper 3.1 vs Plain Visual Studio</font></a> - face to face, feature to feature!</p>
	<div style="font-size: 10px; margin-top: 25px;">Technorati tags: <a href="http://www.technorati.com/tag/ReSharper" rel="tag">ReSharper</a>, <a href="http://www.technorati.com/tag/ReSharper+3.1" rel="tag">ReSharper 3.1</a>, <a href="http://www.technorati.com/tag/Visual+Studio" rel="tag">Visual Studio</a></div>
]]></content:encoded>
			<wfw:commentRSS>http://blogs.jetbrains.com/dotnet/2008/03/resharper-31-vs-visual-studio/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>Create an overloaded delegate quickly</title>
		<link>http://blogs.jetbrains.com/dotnet/2008/03/extract-overloaded-method/</link>
		<comments>http://blogs.jetbrains.com/dotnet/2008/03/extract-overloaded-method/#comments</comments>
		<pubDate>Sun, 23 Mar 2008 14:18:25 +0000</pubDate>
		<dc:creator>jpennal</dc:creator>
		
	<category>ReSharper Tips&#038;Tricks</category>
	<category>How-To's</category>
		<guid>http://blogs.jetbrains.com/dotnet/2008/03/extract-overloaded-method/</guid>
		<description><![CDATA[Sometimes it is necessary to create method overloads that just pass default values to other overloads. ReSharper allows you to do this quickly and easily.

Take this simple method for example:



We need to take the CreateUser method and add a new parameter to it. However, we also need to keep the old CreateUser method signature around [...]]]></description>
			<content:encoded><![CDATA[	<p>Sometimes it is necessary to create method overloads that just pass default values to other overloads. ReSharper allows you to do this quickly and easily.</p>
	<p>Take this simple method for example:
</p>
	<p><img src="http://blogs.jetbrains.com/dotnet/wp-content/img//screenshot_01.jpg" alt="screenshot_01.jpg" border="0" width="467" height="177" /></p>
	<p>We need to take the <strong>CreateUser</strong> method and add a new parameter to it. However, we also need to keep the old <strong>CreateUser</strong> method signature around for other code that still uses that version of the method signature. Using ReSharper&#8217;s <strong>Change Signiture (Control-F6)</strong> feature will allow us to create an overloaded method to solve our problem.</p>
	<p><img src="http://blogs.jetbrains.com/dotnet/wp-content/img//screenshot_02.jpg" alt="screenshot_02.jpg" border="0" width="467" height="142" /></p>
	<p>When the Change Signature dialog opens for this method, we will go ahead and add our new <strong>email</strong> parameter to this method.</p>
	<p><img src="http://blogs.jetbrains.com/dotnet/wp-content/img//screenshot_03.jpg" alt="screenshot_03.jpg" border="0" width="588" height="450" /></p>
	<p>In the above screenshot, notice the option &#8220;Delegate via overloading method&#8221; circled in red. Clicking this box is what will take the signature changes and turn them into a new overloaded method. </p>
	<p>When the changes are ready, clicking <strong>Next</strong> in the Change Signature dialog will now produce the following code.
	<p><img src="http://blogs.jetbrains.com/dotnet/wp-content/img//screenshot_04.jpg" alt="screenshot_04.jpg" border="0" width="577" height="264" /></p>
	<p>Notice that in the <strong>SaveNewUser</strong> method, the original method signature remains intact, but it is now delegated through an overloaded method. The <strong>CreateUser</strong> method now has two overloaded variations, the delegating method and the main method, where we can now add code to handle the new <strong>email</strong> parameter.</p>
	<p>Jeff Pennal<br />
JetBrains .NET Evangelist</p>
]]></content:encoded>
			<wfw:commentRSS>http://blogs.jetbrains.com/dotnet/2008/03/extract-overloaded-method/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>Custom Templates</title>
		<link>http://blogs.jetbrains.com/dotnet/2008/03/custom-templates/</link>
		<comments>http://blogs.jetbrains.com/dotnet/2008/03/custom-templates/#comments</comments>
		<pubDate>Sat, 15 Mar 2008 22:03:22 +0000</pubDate>
		<dc:creator>jpennal</dc:creator>
		
	<category>ReSharper Tips&#038;Tricks</category>
	<category>How-To's</category>
		<guid>http://blogs.jetbrains.com/dotnet/2008/03/custom-templates/</guid>
		<description><![CDATA[ReSharper templates enable you to quickly generate predefined code constructs. Many templates are provided ready to use; you can create new templates, edit existing ones and easily manage them.

Creating and using your own templates is a quick and easy way to help eliminate repetitive code or to automate common tasks. To demonstrate this functionality, I [...]]]></description>
			<content:encoded><![CDATA[	<p>ReSharper templates enable you to quickly generate predefined code constructs. Many templates are provided ready to use; you can create new templates, edit existing ones and easily manage them.</p>
	<p>Creating and using your own templates is a quick and easy way to help eliminate repetitive code or to automate common tasks. To demonstrate this functionality, I am going to show how to use custom templates to add log entries using the <a href="http://logging.apache.org/log4net/">Apache log4net</a> library.<br />
<a id="more-81"></a></p>
	<p>Lets start with a class that looks like this:</p>
	<pre><code>
    public class SampleClass {
        public void doSomething() {
            try {
                String value;
	
                value = getSomeValueFromDatabase();
                Console.Out.WriteLine(value);
            } catch(Exception e) {
            }
        }
	
        private string getSomeValueFromDatabase() {
            return null;
        }
    }
</code></pre>
	<p>The first thing we want to do is to create a template that will allow us to add a new logger to a class. </p>
	<p>To do this, we&#8217;ll open up he ReSharper Template editor, under the Visual Studio.Net menu<br />
<strong>ReSharper -> Options&#8230;</strong>, and then in the options dialog, choose <strong>Live Templates</strong>.</p>
	<p><img src='http://blogs.jetbrains.com/dotnet/wp-content/img/options.jpg' alt='ReSharper Options Dialog' /></p>
	<p>Next, we&#8217;ll create a new template by selecting the <strong>User Templates</strong> item from the available templates  and clicking the <strong>Create Template</strong> button <img src='http://blogs.jetbrains.com/dotnet/wp-content/img/create_new.jpg' alt='' />. This will bring up the <strong>Edit Template</strong> dialog.</p>
	<p>Now we can start to write our template, the first thing we want to do is to give our template an abbreviation. This is the name that we will use to activate this template and make it run, for this example, we&#8217;ll call this &#8220;logger&#8221;.</p>
	<p>The next thing we want to do is to give our template a description, for which I will enter <strong>Create a new logger instance for a class</strong>.</p>
	<p>Once these values are filled in, we are ready to write our template. In the <strong>Template Text</strong> box, we&#8217;ll fill in the value:<br />
<code><br />
protected static readonly ILog log = LogManager.GetLogger(typeof($CLASS$));<br />
</code></p>
	<p>You&#8217;ll notice the declaration $CLASS$. A word surrounded by a $ sign indicates to ReSharper that this is a variable that you want to do something with. In the section below Template Text, called <strong>Template Variables</strong>, ReSharper has automatically created an entry for $CLASS$ that looks like this:<br />
<img src='http://blogs.jetbrains.com/dotnet/wp-content/img/template_variable.jpg' alt='' /></p>
	<p>The power of templates comes when you click the <strong>Choose Macro</strong> link. The macro that we want is called &#8220;Containing Type Name&#8221;. When the template is run, this variable $CLASS$ will run that macro. This will take our template text and replace $CLASS$ with the name of the type containing it. In our case, this will be <strong>SampleClass</strong>.</p>
	<p>You&#8217;ll notice that there is a check box for this variable for <strong>Editable Occurrence</strong>. This allows you to have the user edit the value once it has been applied. We don&#8217;t want it for this case, so we will uncheck this box.</p>
	<p>Now, click <strong>Save</strong> and you&#8217;ll see that you have a new User Defined template. Click <strong>Ok</strong> in the Options dialog to go back to your code.</p>
	<p>Lets see this template in action. Under my class declaration for SampleClass, I will place my caret and hit <strong>Control-J, Insert Live Template</strong>. In this list that appears I will see my new template <strong>logger</strong>.<br />
<img src='http://blogs.jetbrains.com/dotnet/wp-content/img/run_logger_start.jpg' alt='' /></p>
	<p>After hitting tab, I now have:<br />
<img src='http://blogs.jetbrains.com/dotnet/wp-content/img/run_logger_end.jpg' alt='' /></p>
	<p>So now, every time I create a new class and I want to create a log field for it, I only have to use my new template to do it automatically.</p>
	<p>Let&#8217;s do just one more example. For my code, in my try&#8230;catch block, I want to write an entry to the log file that looks lik this:<br />
<code>log.Error("[SampleClass::doSomething] An error as occurred", e);</code><br />
But I want this entire line to be automatically created for me with the values already filled in.</p>
	<p>Let&#8217;s create a new <strong>User Template</strong>, following the same procedure as before and create a new template that looks like this:<br />
<img src='http://blogs.jetbrains.com/dotnet/wp-content/img/le.jpg' alt='' /></p>
	<p>This template is a lot more complex then our last one and works like this. In our Template Text, <code>$logger$.Error("[$CLASS$::$METHOD$] $MESSAGE$", $EXCEPTION$);</code> we are using five variables.</p>
	<p>When the template is run, these five variable will fill in the following information:</p>
	<table>
	<tr>
	<td>$logger$</td>
	<td>ReSharper will suggest that this variable will be replaced by a variable in the current class of type log4Net.ILog</td>
	</tr>
	<tr>
	<td>$CLASS$</td>
	<td>This variable will be replaced by the name of the current class</td>
	</tr>
	<tr>
	<td>$METHOD$</td>
	<td>This variable will be replaced by the name of the method that this template is executed in</td>
	</tr>
	<tr>
	<td>$MESSAGE$</td>
	<td>This variable doesnt have a macro, but it is an editable occurrence. This will allow the user to tpe the specific error message in this spot once the template is run.</td>
	</tr>
	<tr>
	<td>$EXCEPTION$</td>
	<td>This variable will be replaced by a variable of the type System.Exception. Since this template is intended to run inside of a catch block, this will exist.</td>
	</tr>
	</table>
	<p>Finally, when we save and run this template, we see the following:<br />
<img src='http://blogs.jetbrains.com/dotnet/wp-content/img/catch_start.jpg' alt='' /></p>
	<p>Step 1: We find our new template &#8220;le&#8221; and run it</p>
	<p><img src='http://blogs.jetbrains.com/dotnet/wp-content/img/catch_middle.jpg' alt='' /></p>
	<p>Step 2: Our template is created with our editable area surrounded in red. We type in our message</p>
	<p><img src='http://blogs.jetbrains.com/dotnet/wp-content/img/catch_end.jpg' alt='' /></p>
	<p>Step 3: With our message typed in, our template is finished</p>
	<p>Now, every time I want to write a log.Error entry, I can use my <strong>le</strong> template to do this automatically for me, saving me the trouble of writing it out each time.</p>
	<p>As you can see, custom templates can be very powerful. If you would like more information on what  you can do with custom templates, check out ReSharpers help contents. There is a lot of information available on what you are able to do when creating your own custom templates.</p>
	<p>Jeff Pennal<br />
JetBrains .NET Evangelist</p>
	<div style="font-size: 10px; margin-top: 25px;">Technorati tags: <a href="http://www.technorati.com/tag/resharper" rel="tag">resharper</a>, <a href="http://www.technorati.com/tag/visual+studio" rel="tag">visual studio</a>, <a href="http://www.technorati.com/tag/templates" rel="tag">templates</a>, <a href="http://www.technorati.com/tag/customization" rel="tag">customization</a>, <a href="http://www.technorati.com/tag/.net" rel="tag">.net</a></div>
]]></content:encoded>
			<wfw:commentRSS>http://blogs.jetbrains.com/dotnet/2008/03/custom-templates/feed/</wfw:commentRSS>
	</item>
	</channel>
</rss>
