<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1071632340652365387</id><updated>2012-02-15T23:00:49.057-08:00</updated><category term='Check your skills now'/><category term='Tech News'/><category term='SSRS(Sql Server Reporting Services)'/><category term='Model View Controller'/><category term='Visual Studio 2008'/><category term='Visual Studio Tips and Tricks'/><category term='c# 3.0'/><category term='JQuery Optimization'/><title type='text'>Priyang Patel - Resources and news for .net Gurus</title><subtitle type='html'>This blog gives latest technology news and .net information.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>34</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-692371438800413496</id><published>2010-01-18T22:14:00.000-08:00</published><updated>2010-01-18T22:21:32.945-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JQuery Optimization'/><title type='text'>Doloto : AJAX application optimization tool</title><content type='html'>Doloto is an AJAX application optimization tool, especially useful for large and complex Web 2.0 applications that contain a lot of code, such as Bing Maps, Hotmail, etc. Doloto analyzes AJAX application workloads and automatically performs code splitting of existing large Web 2.0 applications. After being processed by Doloto, an application will initially transfer only the portion of code necessary for application initialization.&lt;br /&gt;The rest of the application's code is replaced by short stubs -- their actual function code is transferred lazily in the background or, at the latest, on-demand on first execution. Since code download is interleaved with application execution, users can start interacting with the Web application much sooner, without waiting for the code that implements extra, unused features.&lt;br /&gt;In our experiments across a number of AJAX applications and network conditions, Doloto reduced the amount of initial downloaded JavaScript code by over 40%, or hundreds of kilobytes resulting in startup often faster by 30-40%, depending on network conditions.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/devlabs/ee423534.aspx"&gt;Read more over here....&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-692371438800413496?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/692371438800413496/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=692371438800413496' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/692371438800413496'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/692371438800413496'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2010/01/doloto-ajax-application-optimization.html' title='Doloto : AJAX application optimization tool'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-1418261560813751235</id><published>2009-09-10T04:36:00.000-07:00</published><updated>2009-09-10T04:37:26.886-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Model View Controller'/><title type='text'>RESTful Services With ASP.NET MVC</title><content type='html'>I have found a very nice article of create RESTful Services With ASP.NET MVC.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/magazine/dd943053.aspx"&gt;http://msdn.microsoft.com/en-us/magazine/dd943053.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-1418261560813751235?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/1418261560813751235/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=1418261560813751235' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/1418261560813751235'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/1418261560813751235'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2009/09/restful-services-with-aspnet-mvc.html' title='RESTful Services With ASP.NET MVC'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-2623200988461768119</id><published>2009-09-09T23:33:00.000-07:00</published><updated>2009-09-09T23:39:27.742-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c# 3.0'/><title type='text'>?? Operator (null-coalescing operator)</title><content type='html'>?? is used to define a default value for a nullable value types as well as reference types. It returns the left-hand operand if it is not null; otherwise it returns the right operand.&lt;br /&gt;&lt;br /&gt;A nullable type can contain a value, or it can be undefined. The ?? operator defines the default value to be returned when a nullable type is assigned to a non-nullable type. If you try to assign a nullable value type to a non-nullable value type without using the ?? operator, you will generate a compile-time error. If you use a cast, and the nullable value type is currently undefined, an InvalidOperationException exception will be thrown.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_JBgTe5i3S6g/Sqie9J__6HI/AAAAAAAABQs/MReDWLVbcbY/s1600-h/tempblog.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 124px;" src="http://2.bp.blogspot.com/_JBgTe5i3S6g/Sqie9J__6HI/AAAAAAAABQs/MReDWLVbcbY/s400/tempblog.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5379724528387614834" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-2623200988461768119?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/2623200988461768119/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=2623200988461768119' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/2623200988461768119'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/2623200988461768119'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2009/09/operator-null-coalescing-operator.html' title='?? Operator (null-coalescing operator)'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_JBgTe5i3S6g/Sqie9J__6HI/AAAAAAAABQs/MReDWLVbcbY/s72-c/tempblog.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-2234105828655945848</id><published>2009-09-07T03:09:00.000-07:00</published><updated>2009-09-07T03:10:36.692-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SSRS(Sql Server Reporting Services)'/><title type='text'>SSRS 2005 limitations :</title><content type='html'>&lt;p class="MsoNormal"&gt;I am working with SSRS 2005 since last 8 months and i came across many limitations which should not be there with SSRS . SSRS is still getting matured so please go through following list before choosing SSRS 2005 for reporting in your system.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="mso-tab-count:1"&gt;                &lt;/span&gt;&lt;u&gt;Does not support dynamic width for columns:&lt;o:p&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="mso-tab-count:2"&gt;                                &lt;/span&gt;SSRS doesn’t support dynamic width for columns , also the main problem I found is if you will disable one column based on condition then remaining columns width won’t get adjusted to use hidden columns space. And its very frustrating.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="mso-tab-count:1"&gt;                &lt;/span&gt;&lt;u&gt;Doesn’t support HTML rendering !!!!!!!!!:&lt;o:p&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="mso-tab-count:2"&gt;                                &lt;/span&gt;Yes, Its correct that SSRS 2005 doesn’t support HTML rendering of sent data. It is really surprising for me. &lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="mso-tab-count:1"&gt;                &lt;/span&gt;&lt;u&gt;CanGrow property : &lt;o:p&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="mso-tab-count:2"&gt;                                &lt;/span&gt;SSRS controls have cangrow property, if its true then controls will grow based on its contents width. But its can grow in vertical direction but not in horizontal.....&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="mso-tab-count:1"&gt;                &lt;/span&gt;If this property is set to false then it will auto trim data based on controls width. and then if you want to show “...” to show there are some more &lt;span style="mso-spacerun:yes"&gt; &lt;/span&gt;data then you are in real trouble.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="mso-tab-count:1"&gt;                &lt;/span&gt;There are some more limitations are mentioned at here.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="mso-tab-count:2"&gt;                                &lt;/span&gt;&lt;a href="http://social.msdn.microsoft.com/forums/en-US/sqlreportingservices/thread/0a80874f-e779-49e1-9fbb-7b7d730cd836"&gt;http://social.msdn.microsoft.com/forums/en-US/sqlreportingservices/thread/0a80874f-e779-49e1-9fbb-7b7d730cd836&lt;/a&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="mso-tab-count:1"&gt;                &lt;/span&gt;Hope all this problems are solved with SSRS 2008....:)&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-2234105828655945848?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/2234105828655945848/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=2234105828655945848' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/2234105828655945848'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/2234105828655945848'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2009/09/ssrs-2005-limitations.html' title='SSRS 2005 limitations :'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-742785307286257149</id><published>2009-09-03T03:19:00.000-07:00</published><updated>2009-09-09T23:32:18.358-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Model View Controller'/><title type='text'>Some nice MVC videos</title><content type='html'>Some really nice videos of asp.net MVC presented by Phil Haack.&lt;br /&gt;&lt;br /&gt;Choosing between ASP.NET Web Forms and MVC&lt;br /&gt;&lt;a href="http://videos.visitmix.com/MIX09/T23F"&gt;http://videos.visitmix.com/MIX09/T23F&lt;/a&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;ASP.NET MVC: America's Next Top Model View Controller Framework&lt;br /&gt;&lt;a href="http://videos.visitmix.com/MIX09/T50F"&gt;http://videos.visitmix.com/MIX09/T50F&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;Microsoft ASP.NET Model View Controller (MVC): Ninja on Fire Black Belt Tips&lt;br /&gt;&lt;a href="http://videos.visitmix.com/MIX09/T44F"&gt;http://videos.visitmix.com/MIX09/T44F&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-742785307286257149?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/742785307286257149/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=742785307286257149' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/742785307286257149'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/742785307286257149'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2009/09/some-nice-mvc-videos.html' title='Some nice MVC videos'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-8851600856220852154</id><published>2009-03-27T08:31:00.000-07:00</published><updated>2009-03-27T08:53:44.833-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Model View Controller'/><title type='text'>Something about MVC (Model View Controller)!!!</title><content type='html'>I heard so much about MVC and want to share some basic things about MVC.&lt;br /&gt;Basically MVC is a design pattern defined many years back and ASP.NET MVC Framework is the framework to implement MVC pattern.&lt;br /&gt;As Per wordPress the defination of MVC Pattern is&lt;br /&gt;“Model–View–Controller (MVC) is an &lt;a title="Architectural pattern (computer science)" href="http://en.wikipedia.org/wiki/Architectural_pattern_(computer_science)"&gt;architectural pattern&lt;/a&gt; used in &lt;a title="Software engineering" href="http://en.wikipedia.org/wiki/Software_engineering"&gt;software engineering&lt;/a&gt;. Successful use of the pattern isolates &lt;a title="Business logic" href="http://en.wikipedia.org/wiki/Business_logic"&gt;business logic&lt;/a&gt; from&lt;a title="User interface" href="http://en.wikipedia.org/wiki/User_interface"&gt;user interface&lt;/a&gt; considerations, resulting in an application where it is easier to modify either the visual appearance of the application or the underlying business rules without affecting the other. In MVC, the model represents the information (the data) of the application; the view corresponds to elements of the user interface such as text, checkbox items, and so forth; and the controller manages the communication of data and the business rules used to manipulate the data to and from the model.”&lt;br /&gt;Now lets understand MVC Framework.&lt;br /&gt;&lt;br /&gt;MVC is a framework methodology that divides an application’s implementation into three component roles: models, views, and controllers.&lt;br /&gt;· “Models” in a MVC based application are the components of the application that are responsible for maintaining state. Often this state is persisted inside a database (for example: we might have a Product class that is used to represent order data from the Products table inside SQL).&lt;br /&gt;· “Views” in a MVC based application are the components responsible for displaying the application’s user interface. Typically this UI is created off of the model data (for example: we might create an Product “Edit” view that surfaces textboxes, dropdowns and checkboxes based on the current state of a Product object).&lt;br /&gt;· “Controllers” in a MVC based application are the components responsible for handling end user interaction, manipulating the model, and ultimately choosing a view to render to display UI. In a MVC application the view is only about displaying information - it is the controller that handles and responds to user input and interaction.&lt;br /&gt;One of the benefits of using a MVC methodology is that it helps enforce a clean separation of concerns between the models, views and controllers within an application. Maintaining a clean separation of concerns makes the testing of applications much easier, since the contract between different application components are more clearly defined and articulated.&lt;br /&gt;The MVC pattern can also help enable red/green &lt;a href="http://en.wikipedia.org/wiki/Test-driven_development" target="_blank"&gt;test driven development&lt;/a&gt; (TDD) - where you implement automated unit tests, which define and verify the requirements of new code, first before you actually write the code itself. &lt;img id="BLOGGER_PHOTO_ID_5317895979759726146" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 323px; CURSOR: hand; HEIGHT: 310px; TEXT-ALIGN: center" alt="" src="http://4.bp.blogspot.com/_JBgTe5i3S6g/Scz2N9oObkI/AAAAAAAABEY/C5wKBmqcdHs/s400/MVC.jpg" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;Some benefits of MVC are :&lt;br /&gt;Clear separation of concerns&lt;br /&gt;Testability - support for Test-Driven Development&lt;br /&gt;Fine-grained control over HTML and JavaScript&lt;br /&gt;Intuitive URLs&lt;br /&gt;I will try to post more and more things about MVC.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-8851600856220852154?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/8851600856220852154/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=8851600856220852154' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/8851600856220852154'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/8851600856220852154'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2009/03/something-about-mvc-model-view.html' title='Something about MVC (Model View Controller)!!!'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_JBgTe5i3S6g/Scz2N9oObkI/AAAAAAAABEY/C5wKBmqcdHs/s72-c/MVC.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-4415242881466223236</id><published>2008-06-27T02:25:00.000-07:00</published><updated>2008-06-27T02:30:56.193-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio 2008'/><title type='text'>Visual Studio 2008 and .NET Framework 3.5 SP1 Available Now</title><content type='html'>&lt;p style="font-family: arial;"&gt;The &lt;strong&gt;public beta&lt;/strong&gt; of Visual Studio 2008 and .NET Framework 3.5 SP1 are now available &lt;a set="yes" linkindex="33" href="http://www.aspnetworld.com/blog/ct.ashx?id=6204b811-a2c0-4a1f-8857-ae2191b4ccb7&amp;amp;url=http%3a%2f%2fmsdn.microsoft.com%2fen-us%2fvstudio%2fproducts%2fcc533447.aspx" target="_blank"&gt;here&lt;/a&gt;.&lt;/p&gt; &lt;p style="font-family: arial;"&gt;SP1 comes with a slew of enhancements and fixes covering various aspects of the VS 2008 IDE as well as the .NET Framework.&lt;/p&gt; &lt;p style="font-family: arial;"&gt;Among the highlights relevant to ASP.NET and web development in the upcoming SP1 release include:&lt;/p&gt; &lt;ul style="font-family: arial;"&gt;&lt;li&gt;ASP.NET Data Scaffolding Support (ASP.NET Dynamic Data)&lt;/li&gt;&lt;li&gt;ASP.NET Routing Engine (System.Web.Routing)&lt;/li&gt;&lt;li&gt;ASP.NET AJAX Back/Forward Button History Support&lt;/li&gt;&lt;li&gt;ASP.NET AJAX Script Combining Support&lt;/li&gt;&lt;li&gt;VS 2008 Performance Improvements in HTML Designer and HTML Source Editor&lt;/li&gt;&lt;li&gt;VS 2008 JavaScript Script Formatting and Code Preferences&lt;/li&gt;&lt;li&gt;Better VS Javascript Intellisense for Multiple Javascript/AJAX Frameworks&lt;/li&gt;&lt;li&gt;VS Refactoring Support for WCF Services in ASP.NET Projects&lt;/li&gt;&lt;li&gt;VS Support for Classic ASP Intellisense and Debugging&lt;/li&gt;&lt;li&gt;Visual Web Developer Express Edition support for Class Library and Web Application Projects&lt;/li&gt;&lt;li&gt;ASP.NET Application Request Throughput Improvements of Up to 10% &lt;/li&gt;&lt;li&gt;SQL 2008 Support in VS 2008&lt;/li&gt;&lt;li&gt;ADO.NET Entity Framework and LINQ to Entities&lt;/li&gt;&lt;li&gt;ADO.NET Data Services &lt;/li&gt;&lt;li&gt;WCF Development Improvements&lt;/li&gt;&lt;li&gt;VB and C# Improvements&lt;/li&gt;&lt;/ul&gt; &lt;p style="font-family: arial;"&gt;Other enhancements not mentioned above cover primarily client development (Windows Forms, WPF, and Setup Package).  The SP1 releases are expected to be shipped this summer as free updates.&lt;/p&gt;&lt;span style="font-family: arial;font-family:times new roman;" &gt;For a more detailed description of the new features in the release, check out &lt;/span&gt;&lt;a style="font-family: arial;" set="yes" linkindex="34" href="http://www.aspnetworld.com/blog/ct.ashx?id=6204b811-a2c0-4a1f-8857-ae2191b4ccb7&amp;amp;url=http%3a%2f%2fweblogs.asp.net%2fscottgu%2farchive%2f2008%2f05%2f12%2fvisual-studio-2008-and-net-framework-3-5-service-pack-1-beta.aspx" target="_blank"&gt;Scott Guthrie's blog post&lt;/a&gt;&lt;span style="font-family: arial;font-family:times new roman;" &gt; or &lt;/span&gt;&lt;a style="font-family: arial;" set="yes" linkindex="35" href="http://www.aspnetworld.com/blog/ct.ashx?id=6204b811-a2c0-4a1f-8857-ae2191b4ccb7&amp;amp;url=http%3a%2f%2fblogs.msdn.com%2fsomasegar%2farchive%2f2008%2f05%2f12%2fvisual-studio-2008-and-net-fx-3-5-sp1-beta-available-now.aspx" target="_blank"&gt;Somasegar's blog post&lt;/a&gt;&lt;span style="font-family: arial;font-family:times new roman;" &gt;.&lt;/span&gt;&lt;p style="font-family: arial;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="font-family: arial;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-4415242881466223236?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/4415242881466223236/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=4415242881466223236' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/4415242881466223236'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/4415242881466223236'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2008/06/visual-studio-2008-and-net-framework-35.html' title='Visual Studio 2008 and .NET Framework 3.5 SP1 Available Now'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-5346482223763313760</id><published>2008-06-05T04:47:00.000-07:00</published><updated>2008-06-05T05:20:29.432-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio Tips and Tricks'/><title type='text'>Passing a Variable Number of Arguments to a Method</title><content type='html'>&lt;span style="font-family: times new roman;font-family:arial;" class="bodycopy" &gt;&lt;br /&gt;      If you need to pass an unknown number of arguments to a method, the params keyword is exactly what you need. With params, you can pass a variable number of parameters to a method and any parameters after the fixed parameters will be collected into an array and passed to your method. You can only use the params keyword for one parameter in your method declaration and it must always be the last parameter. A method that accepts a string and then a variable number of parameters of any type looks like this:&lt;br /&gt;  &lt;pre style="font-weight: 700;"&gt;&lt;span class="codeKeyword"&gt;public&lt;/span&gt; &lt;span class="codeKeyword"&gt;void&lt;/span&gt; ObjectParams(&lt;span class="codeKeyword"&gt;string&lt;/span&gt; Message, &lt;span class="codeKeyword"&gt;params&lt;/span&gt; &lt;span class="codeKeyword"&gt;object&lt;/span&gt;[] p)&lt;br /&gt;{&lt;br /&gt; Console.WriteLine(Message);&lt;br /&gt; &lt;span class="codeKeyword"&gt;for&lt;/span&gt; (&lt;span class="codeKeyword"&gt;int&lt;/span&gt; i = 0; i &amp;lt; p.Length; i++)&lt;br /&gt; {&lt;br /&gt;    Console.WriteLine(p[i]);&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;      This method prints the string parameter to the console then loops through variable parameters, printing each one to the console as well. It accepts an array of objects, so the parameters can be any data type. You would call the function like this:&lt;br /&gt;  &lt;pre style="font-weight: 700;"&gt;ObjectParams("Variable Object Parameters", 12, &lt;span class="codeComment"&gt;'z', "Test");&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;      If you know the data type of your arguments, you can optimize this somewhat by specifying a type other than object for the variable parameters. A method that expects a variable number of integers would look like this:&lt;br /&gt;  &lt;pre style="font-weight: 700;"&gt;&lt;span class="codeKeyword"&gt;public&lt;/span&gt; &lt;span class="codeKeyword"&gt;void&lt;/span&gt; IntParams(&lt;span class="codeKeyword"&gt;string&lt;/span&gt; Message, &lt;span class="codeKeyword"&gt;params&lt;/span&gt; &lt;span class="codeKeyword"&gt;int&lt;/span&gt;[] p)&lt;br /&gt;{&lt;br /&gt; Console.WriteLine(Message);&lt;br /&gt; &lt;span class="codeKeyword"&gt;for&lt;/span&gt; (&lt;span class="codeKeyword"&gt;int&lt;/span&gt; i = 0; i &amp;lt; p.Length; i++)&lt;br /&gt; {&lt;br /&gt;    Console.WriteLine(p[i]);&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;      You call this method the same way as before, only passing integers.&lt;br /&gt;  &lt;pre style="font-weight: 700;"&gt;IntParams("Variable Integer Parameters", 1, 2, 3, 4, 5);&lt;/pre&gt;&lt;br /&gt;      You also can pass an array as the last parameter instead of passing individual parameters. The previous method, which accepts integers, also could be called this way.&lt;br /&gt;  &lt;pre style="font-weight: 700;"&gt;&lt;span class="codeKeyword"&gt;int&lt;/span&gt;[] TestIntArray = &lt;span class="codeKeyword"&gt;new&lt;/span&gt; &lt;span class="codeKeyword"&gt;int&lt;/span&gt;[5] { 11, 12, 13, 14, 15 };&lt;br /&gt;IntParams("Integer Array Parameter", TestIntArray);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;      The ability for a method to accept a variable number of parameters can come in handy in many situations. Now, with the params keyword, you have what you need to take advantage of this ability in C#.&lt;br /&gt;  &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-5346482223763313760?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/5346482223763313760/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=5346482223763313760' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/5346482223763313760'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/5346482223763313760'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2008/06/passing-variable-number-of-arguments-to.html' title='Passing a Variable Number of Arguments to a Method'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-3927853691692105195</id><published>2008-06-05T04:35:00.000-07:00</published><updated>2008-06-05T04:42:31.915-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio Tips and Tricks'/><title type='text'>String Literals Without Escape Characters</title><content type='html'>Today's tip is a very simple one, but if you are like me you will find yourself using it frequently. Do you have string literals that are filled with escape characters because they include characters that have a special meaning? One of the most common places you will find this is in file paths. If you don't want to have to worry about getting all of the backslashes correct, try using an @-quoted string instead. Say you have a variable like the following in your application:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:100%;" &gt;string AppDataFile = "C:\\Program Files\\My Application\\MyApp.dat";&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This works fine, but can be hard to read and is more likely to be prone to errors if you do not escape all of the backslashes correctly. Another option, using @-quoted strings, removes the need to escape the backslashes. The @-quoted version of the above example looks like this:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:100%;" &gt;string AppDataFile = @"C:\Program Files\My Application\MyApp.dat";&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The only changes are the addition of the @ sign before the opening quotation mark and the removal of the backslash to escape the other backslashes. This format matches the way you see file and directory paths displayed everywhere else in Windows. You can use @-quoted strings for more than paths, so take a look at your use of string literals and see where you can simplify you code and make it more readable.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-3927853691692105195?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/3927853691692105195/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=3927853691692105195' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/3927853691692105195'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/3927853691692105195'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2008/06/string-literals-without-escape.html' title='String Literals Without Escape Characters'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-6693487429292315966</id><published>2008-06-03T02:43:00.000-07:00</published><updated>2008-06-03T03:45:51.944-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio Tips and Tricks'/><title type='text'>Increase your productivity using visual studio 2008</title><content type='html'>&lt;span style="font-weight: bold;font-family:arial;font-size:100%;"  &gt;Basic Building Commands:&lt;br /&gt;&lt;/span&gt;&lt;p minmax_bound="true"  style="font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;It's an obvious and trivial thing, but the timesaving  will add up, especially for those actions you perform tens or hundreds of times  a day such as building and debugging.  Here are some basic bindings every Visual  Studio developer should know: &lt;/span&gt;&lt;/p&gt; &lt;ul minmax_bound="true"  style="font-family:arial;"&gt;&lt;li minmax_bound="true"&gt;&lt;span style="font-size:100%;"&gt;Build: &lt;strong minmax_bound="true"&gt;CTRL&lt;/strong&gt; +  &lt;strong minmax_bound="true"&gt;SHIFT&lt;/strong&gt; + &lt;strong minmax_bound="true"&gt;B&lt;/strong&gt;&lt;/span&gt;  &lt;/li&gt;&lt;li minmax_bound="true"&gt;&lt;span style="font-size:100%;"&gt;Word completion: &lt;strong minmax_bound="true"&gt;CTRL&lt;/strong&gt; + &lt;strong minmax_bound="true"&gt;SPACE&lt;/strong&gt;&lt;/span&gt;  &lt;/li&gt;&lt;li minmax_bound="true"&gt;&lt;span style="font-size:100%;"&gt;Start with debugging: &lt;strong minmax_bound="true"&gt;F5&lt;/strong&gt;&lt;/span&gt;  &lt;/li&gt;&lt;li minmax_bound="true"&gt;&lt;span style="font-size:100%;"&gt;Start without debugging: &lt;strong minmax_bound="true"&gt;CTRL&lt;/strong&gt; + &lt;strong minmax_bound="true"&gt;F5&lt;/strong&gt;&lt;/span&gt;  &lt;/li&gt;&lt;/ul&gt; &lt;p minmax_bound="true"  style="font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;&lt;em minmax_bound="true"&gt;&lt;/em&gt;Download the &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=E5F902A8-5BB5-4CC6-907E-472809749973&amp;amp;displaylang=en" target="_blank" minmax_bound="true" mce_href="http://www.microsoft.com/downloads/details.aspx?familyid=E5F902A8-5BB5-4CC6-907E-472809749973&amp;amp;displaylang=en"&gt;Visual  C# 2008 Keybinding Reference Poster&lt;/a&gt;.&lt;/span&gt;&lt;/p&gt;&lt;span style="font-weight: bold;font-family:arial;font-size:100%;"  &gt; Use GhostDoc to create XML Comments&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt;Instead of typing XML comments by hand, let a tool do the work for you. Although  macros and snippets are reasonably effective for this, I would recommend &lt;/span&gt;&lt;span style=";font-family:times new roman;font-size:100%;"  &gt;&lt;a href="http://www.roland-weigelt.de/ghostdoc/" target="_blank" minmax_bound="true" mce_href="http://www.roland-weigelt.de/ghostdoc/"&gt;Ghost Doc&lt;/a&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt; over any other  solution. This &lt;/span&gt;&lt;span style=";font-family:times new roman;font-size:100%;"  &gt;&lt;em minmax_bound="true"&gt;free&lt;/em&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt; add-in uses customizable  templates to generate consistent, English-readable documentation based on the  current context.  To use it, right-click (or use CTRL + SHIFT + D) to document  the current element.  For example:&lt;/span&gt; &lt;p minmax_bound="true"  style="font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p minmax_bound="true"  style="font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_JBgTe5i3S6g/SEUTtcE4YiI/AAAAAAAAAP4/SneTj_KD89M/s1600-h/image_thumb.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp0.blogger.com/_JBgTe5i3S6g/SEUTtcE4YiI/AAAAAAAAAP4/SneTj_KD89M/s400/image_thumb.png" alt="" id="BLOGGER_PHOTO_ID_5207590215475552802" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt; &lt;p minmax_bound="true"  style="font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;This generates the following documentation:&lt;/span&gt;&lt;/p&gt;&lt;span style=";font-family:times new roman;font-size:100%;"  &gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_JBgTe5i3S6g/SEUUE8E4YjI/AAAAAAAAAQA/DpdrKQnNldc/s1600-h/image_thumb_1.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_JBgTe5i3S6g/SEUUE8E4YjI/AAAAAAAAAQA/DpdrKQnNldc/s400/image_thumb_1.png" alt="" id="BLOGGER_PHOTO_ID_5207590619202478642" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;"&gt;Auto-Implement Properties&lt;/span&gt; &lt;/span&gt; &lt;p  style="font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;Take advantage of a new feature of C#: &lt;a set="yes" linkindex="17" href="http://msdn2.microsoft.com/en-us/library/bb384054.aspx" target="_blank" mce_href="http://msdn2.microsoft.com/en-us/library/bb384054.aspx"&gt;auto-implemented properties&lt;/a&gt;. Rather than creating a private backing field for your properties, let the compiler do it for you. The following demonstrates the syntax: &lt;/span&gt;&lt;/p&gt;&lt;span style=";font-family:times new roman;font-size:100%;"  &gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_JBgTe5i3S6g/SEUVLME4YkI/AAAAAAAAAQI/P0imhlpnmyQ/s1600-h/image_thumb_2.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp3.blogger.com/_JBgTe5i3S6g/SEUVLME4YkI/AAAAAAAAAQI/P0imhlpnmyQ/s400/image_thumb_2.png" alt="" id="BLOGGER_PHOTO_ID_5207591826088288834" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;p minmax_bound="true"  style="font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;Use the code snippet to make this even faster.  Type  &lt;strong minmax_bound="true"&gt;prop&lt;/strong&gt; (the shortcut for an auto-implemented  property) followed by &lt;strong minmax_bound="true"&gt;TAB&lt;/strong&gt; &lt;strong minmax_bound="true"&gt;TAB&lt;/strong&gt;.  Then fill in the data type and property  name:&lt;/span&gt;&lt;/p&gt;&lt;p minmax_bound="true"  style="font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_JBgTe5i3S6g/SEUVLME4YlI/AAAAAAAAAQQ/CSYMy3EPoMg/s1600-h/image_thumb_14.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp3.blogger.com/_JBgTe5i3S6g/SEUVLME4YlI/AAAAAAAAAQQ/CSYMy3EPoMg/s400/image_thumb_14.png" alt="" id="BLOGGER_PHOTO_ID_5207591826088288850" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-weight: bold;font-family:arial;font-size:100%;"  &gt;Refactor&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;The refactor feature in Visual Studio is indispensable  for many tasks, especially renaming, but one productivity feature I particularly  like is &lt;em minmax_bound="true"&gt;Encapsulate Field&lt;/em&gt;. If you are unable to use  an auto-implemented property, declare a private field and let Visual Studio  generate the Property for you.  To use this feature, right-click on the field  and select &lt;em minmax_bound="true"&gt;Refactor&lt;/em&gt; &gt; &lt;em minmax_bound="true"&gt;Encapsulate Field...&lt;/em&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt; &lt;p minmax_bound="true" mce_keep="true"  style="font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_JBgTe5i3S6g/SEUWxsE4YmI/AAAAAAAAAQY/Wd0sdE1dT5o/s1600-h/image_thumb_3.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp1.blogger.com/_JBgTe5i3S6g/SEUWxsE4YmI/AAAAAAAAAQY/Wd0sdE1dT5o/s400/image_thumb_3.png" alt="" id="BLOGGER_PHOTO_ID_5207593587024880226" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p minmax_bound="true" mce_keep="true"  style="font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt; The property is created for you: &lt;/span&gt;&lt;/p&gt;&lt;p minmax_bound="true"  style="font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_JBgTe5i3S6g/SEUWxsE4YnI/AAAAAAAAAQg/smFKIrhVjxk/s1600-h/image_thumb_4.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp1.blogger.com/_JBgTe5i3S6g/SEUWxsE4YnI/AAAAAAAAAQg/smFKIrhVjxk/s400/image_thumb_4.png" alt="" id="BLOGGER_PHOTO_ID_5207593587024880242" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;"&gt;Add Commands to Visual Studio 2008&lt;/span&gt; &lt;/span&gt; &lt;p minmax_bound="true"  style="font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;Install the &lt;a href="http://code.msdn.microsoft.com/PowerCommands" target="_blank" minmax_bound="true" mce_href="http://code.msdn.microsoft.com/PowerCommands"&gt;PowerCommands for Visual  Studio 2008&lt;/a&gt; to add several productivity commands such as: &lt;/span&gt;&lt;/p&gt; &lt;ul minmax_bound="true"  style="font-family:arial;"&gt;&lt;li minmax_bound="true"&gt;&lt;span style="font-size:100%;"&gt;Close all documents  &lt;/span&gt;&lt;/li&gt;&lt;li minmax_bound="true"&gt;&lt;span style="font-size:100%;"&gt;Copy and paste a class (automatically renames)  &lt;/span&gt;&lt;/li&gt;&lt;li minmax_bound="true"&gt;&lt;span style="font-size:100%;"&gt;Remove and sort using statements project-wide  &lt;/span&gt;&lt;/li&gt;&lt;li minmax_bound="true"&gt;&lt;span style="font-size:100%;"&gt;Copy and paste references (including a project  reference) &lt;/span&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p minmax_bound="true"  style="font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;Install the &lt;a href="http://msdn2.microsoft.com/en-us/tfs2008/bb980963.aspx" target="_blank" minmax_bound="true" mce_href="http://msdn2.microsoft.com/en-us/tfs2008/bb980963.aspx"&gt;Team  Foundation Server Power Tools&lt;/a&gt; to add several TFS productivity commands such  as:&lt;/span&gt;&lt;/p&gt;&lt;ul minmax_bound="true"  style="font-family:arial;"&gt;&lt;li minmax_bound="true"&gt;&lt;span style="font-size:100%;"&gt;Find in source control  &lt;/span&gt;&lt;/li&gt;&lt;li minmax_bound="true"&gt;&lt;span style="font-size:100%;"&gt;Open source folder in Windows Explorer  &lt;/span&gt;&lt;/li&gt;&lt;li minmax_bound="true"&gt;&lt;span style="font-size:100%;"&gt;Work item templates (can be used to set values on  multiple work items at once)&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p minmax_bound="true"  style="font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;Add your own productivity commands.  For example, to add  &lt;a href="http://www.aisto.com/roeder/dotnet/" target="_blank" minmax_bound="true" mce_href="http://www.aisto.com/roeder/dotnet/"&gt;Reflector&lt;/a&gt; so it automatically  opens on the current project.&lt;/span&gt;&lt;/p&gt; &lt;ul minmax_bound="true"  style="font-family:arial;"&gt;&lt;li minmax_bound="true"&gt;&lt;span style="font-size:100%;"&gt;Select Tools &gt; External Tools  &lt;/span&gt;&lt;/li&gt;&lt;li minmax_bound="true"&gt;&lt;span style="font-size:100%;"&gt;Click Add  &lt;/span&gt;&lt;/li&gt;&lt;li minmax_bound="true"&gt;&lt;span style="font-size:100%;"&gt;Name it Reflector and browse to the executable  &lt;/span&gt;&lt;/li&gt;&lt;li minmax_bound="true"&gt;&lt;span style="font-size:100%;"&gt;Enter $(TargetPath) for the Arguments&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style=";font-family:times new roman;font-size:100%;"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;font-size:100%;" &gt;Speed up Compilation with Project Configuration&lt;/span&gt; &lt;p minmax_bound="true"  style="font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;You may build tens of times during a programming session,  so don't enable anything that isn't absolute necessary such as code analysis and  XML documentation.  Develop in Debug configuration, and switch to Release  configuration just before check-in to run code analysis and generate XML  documentation. In a large solution I recently worked on, this shaved a minute  off compilation time.&lt;/span&gt;&lt;/p&gt;&lt;p minmax_bound="true"  style="font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_JBgTe5i3S6g/SEUXZsE4YoI/AAAAAAAAAQo/A91ZV4wJ30g/s1600-h/image_thumb_5.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp1.blogger.com/_JBgTe5i3S6g/SEUXZsE4YoI/AAAAAAAAAQo/A91ZV4wJ30g/s400/image_thumb_5.png" alt="" id="BLOGGER_PHOTO_ID_5207594274219647618" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt; &lt;p minmax_bound="true"  style="font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;The following shows code analysis &lt;em minmax_bound="true"&gt;disabled&lt;/em&gt; in Debug configuration:&lt;/span&gt;&lt;/p&gt;&lt;p minmax_bound="true"  style="font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_JBgTe5i3S6g/SEUXZ8E4YpI/AAAAAAAAAQw/D_sDTM_Io_k/s1600-h/image_thumb_6.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_JBgTe5i3S6g/SEUXZ8E4YpI/AAAAAAAAAQw/D_sDTM_Io_k/s400/image_thumb_6.png" alt="" id="BLOGGER_PHOTO_ID_5207594278514614930" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-weight: bold;font-family:arial;font-size:100%;"  &gt;Let Visual Studio Generate Unit Test Code&lt;/span&gt; &lt;p minmax_bound="true"  style="font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;Although it can't fully automate unit testing yet (check  out &lt;a href="http://research.microsoft.com/projects/Pex/" target="_blank" minmax_bound="true" mce_href="http://research.microsoft.com/projects/Pex/"&gt;Pex&lt;/a&gt;), Visual Studio  does a good job of generating &lt;a href="http://en.wikipedia.org/wiki/Test-driven_development" target="_blank" minmax_bound="true" mce_href="http://en.wikipedia.org/wiki/Test-driven_development"&gt;positive unit  test&lt;/a&gt; code to give you a jump start.  To use this feature, right-click on an  element you would like to test and select &lt;em minmax_bound="true"&gt;Create Unit  Tests...&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p minmax_bound="true"  style="font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;em minmax_bound="true"&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p minmax_bound="true"  style="font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_JBgTe5i3S6g/SEUc-sE4YqI/AAAAAAAAAQ4/DYRoLhfhy9Q/s1600-h/image_thumb_7.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp1.blogger.com/_JBgTe5i3S6g/SEUc-sE4YqI/AAAAAAAAAQ4/DYRoLhfhy9Q/s400/image_thumb_7.png" alt="" id="BLOGGER_PHOTO_ID_5207600407432946338" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p minmax_bound="true"  style="font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;Visual Studio generates the following test method:&lt;/span&gt;&lt;/p&gt;&lt;p minmax_bound="true"  style="font-family:arial;"&gt;&lt;span style="font-size:100%;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_JBgTe5i3S6g/SEUc-sE4YrI/AAAAAAAAARA/Lw1muEfg_VA/s1600-h/image_thumb_8.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp1.blogger.com/_JBgTe5i3S6g/SEUc-sE4YrI/AAAAAAAAARA/Lw1muEfg_VA/s400/image_thumb_8.png" alt="" id="BLOGGER_PHOTO_ID_5207600407432946354" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="font-family: arial;" minmax_bound="true" mce_keep="true"&gt; &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-6693487429292315966?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/6693487429292315966/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=6693487429292315966' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/6693487429292315966'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/6693487429292315966'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2008/06/increase-your-productivity-using-visual.html' title='Increase your productivity using visual studio 2008'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp0.blogger.com/_JBgTe5i3S6g/SEUTtcE4YiI/AAAAAAAAAP4/SneTj_KD89M/s72-c/image_thumb.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-2861505232834660042</id><published>2008-05-30T03:50:00.000-07:00</published><updated>2008-05-30T04:03:24.039-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio Tips and Tricks'/><title type='text'>Find files faster with Find Combo Box !!!!</title><content type='html'>This is the Find dropdown that is on the Standard Toolbar, not the Find dialog. Use the shortcut &lt;strong&gt;CTRL+D&lt;/strong&gt; to activate the Find &lt;em&gt;dropdown&lt;/em&gt; in normal mode. Use &lt;strong&gt;CTRL+/&lt;/strong&gt; to activate the Find dropdown in command mode (with "&gt;" prepended… this doesn’t work sometimes for me).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_JBgTe5i3S6g/SD_e0cE4YgI/AAAAAAAAAPk/Oq094dxpwFA/s1600-h/VS2005-Productivity-Find-Combo.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_JBgTe5i3S6g/SD_e0cE4YgI/AAAAAAAAAPk/Oq094dxpwFA/s400/VS2005-Productivity-Find-Combo.jpg" alt="" id="BLOGGER_PHOTO_ID_5206124686734811650" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;To quickly go to a file, type &lt;strong&gt;CTRL+D&lt;/strong&gt;, &gt;&lt;strong&gt;open&lt;/strong&gt;  &lt;start&gt;. Intellisense works here just like in the Command Window. "&lt;strong&gt;of"&lt;/strong&gt; (short for "open file") can be used instead of &lt;strong&gt;open&lt;/strong&gt;. Compare this with opening Solution Explorer, expand the correct folder/project, and visually hunt for the file you need.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-2861505232834660042?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/2861505232834660042/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=2861505232834660042' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/2861505232834660042'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/2861505232834660042'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2008/05/find-files-faster-with-find-combo-box.html' title='Find files faster with Find Combo Box !!!!'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp2.blogger.com/_JBgTe5i3S6g/SD_e0cE4YgI/AAAAAAAAAPk/Oq094dxpwFA/s72-c/VS2005-Productivity-Find-Combo.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-8051438178762268108</id><published>2008-05-30T03:47:00.000-07:00</published><updated>2008-05-30T03:50:15.934-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio Tips and Tricks'/><title type='text'>Start debugging faster by "Attach to Process"</title><content type='html'>&lt;p&gt;Most ASP.NET developers use the standard &lt;strong&gt;F5&lt;/strong&gt; (Debug/Start Debugging) to start debugging from Visual Studio. However, there is a much faster way to start debugging if you already have an instance of your web application running. Just attach to it instead:&lt;/p&gt; &lt;ul&gt;&lt;li&gt;Choose Debug/Attach to Process. &lt;/li&gt;&lt;li&gt;Select the "aspnet_wp.exe" process and choose Attach. &lt;/li&gt;&lt;/ul&gt;Debugging this way is faster because you skip the often-lengthy compilation step, and you don’t have to navigate from the start page to the actual page that you want to debug.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-8051438178762268108?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/8051438178762268108/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=8051438178762268108' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/8051438178762268108'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/8051438178762268108'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2008/05/start-debugging-faster-by-attach-to.html' title='Start debugging faster by &quot;Attach to Process&quot;'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-2511194403476692119</id><published>2008-05-26T23:43:00.000-07:00</published><updated>2008-05-26T23:57:01.671-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio Tips and Tricks'/><title type='text'>Enjoy Code Snippet with Visual Studio 2008 !!!!!!!</title><content type='html'>If you know what is  &lt;span style="font-weight: bold;"&gt;"Code Snippet" ? &lt;/span&gt;&amp;amp;&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;how to use it? with visual studio 2005.&lt;br /&gt;&lt;br /&gt;But now if you are using Visual Studio 2008 then you won't find it. Don't worry it is not removed from visual studio, you can still use it.&lt;br /&gt;&lt;br /&gt;Copy and paste or create your snippet file to following address of your computer:&lt;br /&gt;&lt;br /&gt;    &lt;span style="font-weight: bold;"&gt;My Documents\Visual Studio 2008\Code Snippets\Visual C#\My Code Snippets&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;It's done, just go to visual studio and write down snippet name and press tab.&lt;br /&gt;&lt;br /&gt;Cheers!!!!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-2511194403476692119?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/2511194403476692119/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=2511194403476692119' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/2511194403476692119'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/2511194403476692119'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2008/05/enjoy-code-snippet-with-visual-studio.html' title='Enjoy Code Snippet with Visual Studio 2008 !!!!!!!'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-4095441805937852032</id><published>2008-04-09T02:17:00.000-07:00</published><updated>2008-04-09T20:49:30.464-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Check your skills now'/><title type='text'>Test your .NET skills</title><content type='html'>&lt;span style="font-weight: bold;font-family:times new roman;font-size:100%;"  &gt;&lt;span class="fltrivia"&gt; Shared assemblies are installed where?&lt;/span&gt;&lt;/span&gt;&lt;!-- B --&gt; &lt;p  class="flitems" style="font-family:times new roman;"&gt;&lt;span style="font-size:100%;"&gt;(A) System Assembly Cache         (B) Global Assembly Cache &lt;/span&gt;&lt;/p&gt; &lt;p  class="flitems" style="font-family:times new roman;"&gt;&lt;span style="font-size:100%;"&gt;(C) Machine Assembly Cache       (D) Windows Assembly Cache &lt;/span&gt;&lt;/p&gt;  &lt;p style="font-weight: bold;font-family:times new roman;"  class="flitems"&gt;&lt;span style="font-size:100%;"&gt;&lt;span class="fltrivia"&gt; Which of the following is not a method of System.Object?&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;!-- D --&gt; &lt;p  class="flitems" style="font-family:times new roman;"&gt;&lt;span style="font-size:100%;"&gt;(A) GetType          (B) ToString            (C) Equals             (D) Clone&lt;/span&gt;&lt;/p&gt;&lt;p style="font-weight: bold;font-family:times new roman;"  class="flitems"&gt;&lt;span style="font-size:100%;"&gt;&lt;span class="fltrivia"&gt; What is the term used to describe the process the Runtime uses to find an assembly?&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;!-- B --&gt; &lt;span style=";font-family:times new roman;font-size:100%;"  &gt;(A) Locating          (B)  Probing            (C) Searchi&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;p  class="flrtitem" style="font-family:times new roman;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;"&gt;What is the default value for the Char type?&lt;/span&gt;&lt;br /&gt;Ans: &lt;b&gt;'\0'&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; &lt;p  class="flrtitem" style="font-family:times new roman;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;"&gt;Which of the following is a value type, and not a reference type?&lt;/span&gt;&lt;br /&gt;Ans: &lt;b&gt; enum&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; &lt;p  class="flrtitem" style="font-family:times new roman;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;"&gt;What is the default version of an assembly?&lt;/span&gt;&lt;br /&gt;Ans: &lt;b&gt; 1:0:0:0&lt;/b&gt;&lt;/span&gt;   &lt;/p&gt;&lt;span style=";font-family:times new roman;font-size:100%;"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:times new roman;font-size:100%;"  &gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-4095441805937852032?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/4095441805937852032/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=4095441805937852032' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/4095441805937852032'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/4095441805937852032'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2008/04/test-your-net-skills.html' title='Test your .NET skills'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-8790079418334964476</id><published>2008-04-07T22:36:00.000-07:00</published><updated>2008-04-09T01:21:00.193-07:00</updated><title type='text'>Do more with C# &amp; Functional programming - Treat Code as Data</title><content type='html'>Take advantage of new features in C# 3.0 that let you treat  code as data -- and save time over more traditional, imperative approaches to  programming.  &lt;p class="articlebyline"&gt;&lt;br /&gt;&lt;/p&gt; &lt;div id="articlebody"&gt;LINQ and C# 3.0 will force you to learn some new idioms in your everyday  programming tasks. The idiom that has the most far-reaching consequences is  learning to treat code as data. Every time you build a query expression, you're  treating code as data. You're passing around bits of code or logic as parameters  to a method. The methods in the LINQ libraries don't return data, but delegates  that can create the data when you need them. This might feel strange, but it's  not as far-fetched as it sounds. From the outside, it shouldn't matter whether a  data value is cached or is computed from first principles. For example, this bit  of code shouldn't seem scary: &lt;span id="intelliTXT"&gt;  &lt;pre class="codesnippet"&gt;var num = Math.Sin(Math.PI / 4.0);&lt;script language="JavaScript"&gt;DATA[ */ &lt;!-- Hide from old browsers adserver = "http://ad101com.adbureau.net"; target = "/site=VSM/area=columns/aamsz=336x280/pos=m03/target="; random = Math.round(Math.random() * 100000000); if (!pageNum) var pageNum = Math.round(Math.random() * 100000000); document.write('&lt;scr'); src=" ' + adserver + '/jserver/acc_random=' + random + target + " pageid=" + pageNum + '"&gt;'); document.write('&lt;/SCR'); document.write('IPT&gt;'); // End Hide --&gt; /*]]&gt; */ &lt;/script&gt; &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Do you know whether Math.Sin computes the sine of the angle when you  call it? In many libraries, numeric methods like these are implemented using a  large lookup table. The method simply returns the value in the lookup table, or  makes a linear interpolation of the two nearest values if the request angle  isn't in the lookup table.   &lt;p&gt;From your perspective as the one initiating a call to this method, it doesn't  matter. The contract of the method is to return a value corresponding to the  input parameter. How it happens isn't important. &lt;/p&gt; &lt;p&gt;There's one key point to consider here: I said that how the calculation  happens isn't important. That's true -- unless the calculation depends on some  side effect. Sine doesn't depend on any side effects, so it works no matter  what. Other methods aren't pure functions. For example, this method depends on  information beyond the current parameters: &lt;/p&gt;&lt;pre class="codesnippet"&gt;public static decimal CurrentTemperature(int zipCode)&lt;/pre&gt; &lt;p&gt;Calling this method at different times with the same input gives different  answers. Temperature varies over the course of a day. Substituting the answer (a  number that won't change) for a function (some way to find the current answer)  doesn't work. &lt;/p&gt; &lt;p&gt;There are also quite a few gray areas, where the answer to whether or not you  can substitute a function for data or vice versa turns out to be: "It depends."  &lt;/p&gt; &lt;p&gt;&lt;b&gt;Methods as Parameters Are familiar&lt;/b&gt;&lt;br /&gt;You've worked with methods as  parameters before. The List.RemoveAll() method uses a predicate to determine  what items to remove from a list. This predicate is a pure function; it depends  only on its input: &lt;/p&gt;&lt;pre class="codesnippet"&gt;numbers.RemoveAll((n) =&gt; n &gt; 20);&lt;/pre&gt; &lt;p&gt;You can also use the ForEach method to print a list of numbers: &lt;/p&gt;&lt;pre class="codesnippet"&gt;numbers.ForEach((n) =&gt; Console.WriteLine(n));&lt;/pre&gt; &lt;p&gt;However, this bit of code is much more complicated, and it has dependencies  related to how the internal algorithm is implemented. For example, this code  removes all numbers from a list of integers where the number is greater than its  index in the list: &lt;/p&gt;&lt;pre class="codesnippet"&gt;numbers.RemoveAll((n) =&gt; n &gt;&lt;br /&gt;numbers.IndexOf(n));&lt;/pre&gt; &lt;p&gt;This isn't a pure function because the output depends on something other than  the input. Namely, it depends on the current program's state. Does RemoveAll()  remove each element as it's processed? That would change the current index of  the items. Or, does it perform all the tests and then perform a bulk remove? In  which order does it examine the list? First to last? Or last to first? The  results of this code will depend on the answers to these questions. (For the  record, RemoveAll performs all of the tests, and then removes all of the items.  Knowing that doesn't make this code any more excusable, however.) &lt;/p&gt; &lt;p&gt;There are quite a few new techniques and concepts that you use when you begin  to think of your code as data. You'll be using lambda expressions, deferred  execution, closures, higher order functions, and function composition. And,  unlike switching to a pure functional language, you'll likely be mixing your  current object-oriented style of programming with this new functional approach,  where functions are data. Yes, it's a steep learning curve, but the ends are  worth the effort. &lt;/p&gt; &lt;p&gt;It's possible to implement every one of the techniques just mentioned in C#  2.0, but you can do so much more easily in C# 3.0 because the syntax is so much  cleaner, so I'll show you how to implement these techniques using C# 3.0's  syntax. &lt;/p&gt; &lt;p&gt;A lambda expression is nothing more than a simplified way to express a  method. (In the formal definition, lambda expressions shouldn't have any side  effects, but C# doesn't enforce this rule.) Consider this statement from earlier  in the article: &lt;/p&gt;&lt;pre class="codesnippet"&gt;numbers.ForEach((n) =&gt; Console.WriteLine(n));&lt;/pre&gt; &lt;p&gt;This is nothing more than a concise way of saying: &lt;/p&gt;&lt;pre class="codesnippet"&gt;numbers.ForEach(delegate(int n )&lt;br /&gt;{&lt;br /&gt;Console.WriteLine(n);&lt;br /&gt;});&lt;/pre&gt; &lt;p&gt;Using the lambda syntax, the compiler infers the type of the parameter (an  integer) and the type of the return (void in this case). There's nothing too  earth-shattering here, but you must keep the key point in mind: You're passing a  function (in the form of a delegate) to the ForEach method. Essentially, the  parameter is describing the algorithm. That's a fundamental change in terms of  how you think about your code. &lt;/p&gt; &lt;p&gt;Deferred execution changes your thinking about code in some important ways  (see &lt;a href="http://visualstudiomagazine.com/listings/list.aspx?id=324" target="_blank"&gt;Listing 1&lt;/a&gt;). Now consider the output from a test that runs the  code in &lt;a href="http://visualstudiomagazine.com/listings/list.aspx?id=324" target="_blank"&gt;Listing 1&lt;/a&gt;: &lt;/p&gt;&lt;pre class="codesnippet"&gt;2/19/2008 2:18:14 PM&lt;br /&gt;2/19/2008 2:18:23 PM&lt;br /&gt;2/19/2008 2:18:32 PM&lt;br /&gt;2/19/2008 2:18:41 PM&lt;br /&gt;2/19/2008 2:18:50 PM&lt;br /&gt;Do it again&lt;br /&gt;2/19/2008 2:19:08 PM&lt;br /&gt;2/19/2008 2:19:17 PM&lt;br /&gt;2/19/2008 2:19:26 PM&lt;br /&gt;2/19/2008 2:19:35 PM&lt;br /&gt;2/19/2008 2:19:44 PM&lt;/pre&gt; &lt;p&gt;I chose to use the DateTime.Now property to generate the sequence because it  gives you a clear picture of when operations happen. You can see that there's a  nine-second delay between generating the next sequence item. Also, when you  examine the sequence again, you get a totally different sequence of times. The  sequence is an algorithm that can create values, but the sequence isn't the  values themselves. Again, you're now treating code as data. The sequence of  values doesn't exist until you ask for it. Even after you ask for it, the  variable sequence still doesn't contain values. If you examine it again, you see  a new sequence of values. &lt;/p&gt; &lt;p&gt;&lt;b&gt;Closures Introduce Bound Variables&lt;/b&gt;&lt;br /&gt;One more bit of dry computer  science, and then we can move onto the more interesting ramifications of  treating code as data. Assume you alter &lt;a href="http://visualstudiomagazine.com/listings/list.aspx?id=324" target="_blank"&gt;Listing 1&lt;/a&gt; to create different behavior (see &lt;a href="http://visualstudiomagazine.com/listings/list.aspx?id=325" target="_blank"&gt;Listing 2&lt;/a&gt;). Now, examine its output: &lt;/p&gt;&lt;pre class="codesnippet"&gt;2/19/2008 2:34:27 PM&lt;br /&gt;2/19/2008 2:34:27 PM&lt;br /&gt;2/19/2008 2:34:27 PM&lt;br /&gt;2/19/2008 2:34:27 PM&lt;br /&gt;2/19/2008 2:34:27 PM&lt;br /&gt;Do it again&lt;br /&gt;2/19/2008 2:35:21 PM&lt;br /&gt;2/19/2008 2:35:21 PM&lt;br /&gt;2/19/2008 2:35:21 PM&lt;br /&gt;2/19/2008 2:35:21 PM&lt;br /&gt;2/19/2008 2:35:21 PM&lt;/pre&gt; &lt;p&gt;What changed? Well, the compiler created a closure containing Current as a  bound variable. A closure is a way to inject local variables (or parameters)  into the body of the lambda expression. Those local variables are referred to as  "bound variables." The closure contains both the local variables and lambda  expressions. The code is implemented in such a way that changes to the bound  variable outside of the lambda expression are reflected inside the lambda  expression, and vice versa. In this piece of code, you see that the generator  returns a sequence containing five copies of the current time. Later, you modify  the value of the bound variable (current), outside the lambda. The next time you  enumerate the sequence, you get five copies of the newer version of the  variable. &lt;/p&gt; &lt;p&gt;&lt;b&gt;Putting This to Work&lt;/b&gt;&lt;br /&gt;All of this is wonderful, but why should you  care? Using this kind of algorithm can help you create snippets of code to reuse  later. Think about how many times you've written code like this: &lt;/p&gt;&lt;pre class="codesnippet"&gt;var currentCustmers =&lt;br /&gt;From c in customerList&lt;br /&gt;Where c.Orders.Count &gt; 0&lt;br /&gt;Select c;&lt;/pre&gt; &lt;p&gt;Because that variable contains code, not just data, you're actually creating  a bit of logic that gives you the current customer list when requested, rather  than when the logic executed originally. Instead of copying that code  everywhere, you need only access that code when you need it. &lt;/p&gt; &lt;p&gt;Another advantage is that you can work with sequences that are far too large  to examine or process on your local machine. You can chain these sequence  operators together. When you do that, you're not making new copies of data.  You're manipulating the algorithm and the &lt;i&gt;functions&lt;/i&gt;, and that new set of  functions provides a new answer when you examine it. &lt;/p&gt; &lt;p&gt;You can see this at work by converting an ancient numeric algorithm from  imperative to declarative. You can find full source for this conversion in the  online code, but I'll highlight the key points in this article's inline code. &lt;a href="http://tinyurl.com/y86z4j" target="_blank"&gt;Hero of Alexandria's algorithm  for finding square roots&lt;/a&gt; lets you find the square root of any number S, by  starting with a guess G (S-1 works fine). The next guess is computed using the  formula ((S / G + G) / 2). For example, to find the square root of 2, you start  with 1 as the guess. The next guess is 1.5 ((2 / 1 + 1) / 2). The next guess is  1.416 ((2 / 1.5 + 1.5) / 2). After enough iterations, the answer converges on  the square root. &lt;/p&gt; &lt;p&gt;You begin with a classic C# imperative implementation of Hero's algorithm  (see &lt;a href="http://visualstudiomagazine.com/listings/list.aspx?id=326" target="_blank"&gt;Listing 3&lt;/a&gt;). Next, you make a set of changes and re-implement  this algorithm to make it more declarative, or functional (see &lt;a href="http://visualstudiomagazine.com/listings/list.aspx?id=327" target="_blank"&gt;Listing 4&lt;/a&gt;). &lt;/p&gt; &lt;p&gt;It's a twist, so look at this revised listing carefully. Begin with  HeroRootFunc, which defines a function that creates a sequence of guesses. It  returns the last number in the sequence. The method contains two anonymous  methods that define how to generate the next number, and when to stop. This  expression defines how to generate the next number: &lt;/p&gt;&lt;pre class="codesnippet"&gt;(g) =&gt; ((square / g + g) / 2)&lt;/pre&gt; &lt;p&gt;This expression defines when to terminate the sequence: &lt;/p&gt;&lt;pre class="codesnippet"&gt;(c, n) =&gt; Math.Abs(c - n) &gt; epsilon)&lt;/pre&gt; &lt;p&gt;The query expression returns the entire sequence. The Last() extension method  returns the last value in the sequence, which is the best answer. &lt;/p&gt; &lt;p&gt;The GenerateSequence() method generates the sequence while the test method  returns true. It creates the sequence by evaluating each of the functions used  as arguments. These methods generate the sequence and perform the tests.  However, they only generate the sequence when someone asks for the final number.  &lt;/p&gt; &lt;p&gt;Look again at the implementation of the functional version of Hero's  algorithm. The sequence function generates an infinite sequence. This algorithm  would run out of memory if it were imperative. No matter how you do it, you  can't fit an infinite number of elements in memory. It would also take an  infinite amount of time. And yet, this works, because the functions defined as  parameters are evaluated only when requested. Also, the GenerateSequence()  method can be used for other purposes. &lt;/p&gt; &lt;p&gt;Not every problem is best solved using functional approaches, but many  problems can be solved more succinctly and more clearly by rethinking parameters  and return types. Instead of sending all the data, you can send along a function  that can generate the data you need. Sometimes that can give you the answer  while requiring much less work on your part. &lt;/p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-8790079418334964476?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/8790079418334964476/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=8790079418334964476' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/8790079418334964476'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/8790079418334964476'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2008/04/do-more-with-c-functional-programming.html' title='Do more with C# &amp; Functional programming - Treat Code as Data'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-6744406452942720295</id><published>2008-04-07T02:27:00.000-07:00</published><updated>2008-04-07T02:33:15.259-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio Tips and Tricks'/><title type='text'>Highly customizable CAPTCHA verification. Its Free !!!</title><content type='html'>Learn and defend your ASP.NET sites against evil bots with this free web control that provides instant, highly customizable CAPTCHA verification.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://steveorr.net/articles/CAPTCHASP.aspx"&gt;Its Free !!!&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-6744406452942720295?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/6744406452942720295/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=6744406452942720295' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/6744406452942720295'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/6744406452942720295'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2008/04/highly-customizable-captcha.html' title='Highly customizable CAPTCHA verification. Its Free !!!'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-2455188853748288548</id><published>2008-04-02T01:42:00.000-07:00</published><updated>2008-04-02T01:43:09.283-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio Tips and Tricks'/><title type='text'>Visual studio Posters!!!!! Very useful</title><content type='html'>&lt;p&gt;Hear is the interesting blog post containing links to posters about Microsoft technologies.&lt;/p&gt;  &lt;p&gt;It lists posters for &lt;b&gt;Visual studio 2008!!!&lt;/b&gt; also with C# and VB. Also it contains posters for developers , business apps and professional apps also. &lt;/p&gt; &lt;p&gt;&lt;a target="_blank" mce_href="http://blogs.msdn.com/carloc/archive/2007/11/24/posters-posters-and-again-posters.aspx" href="http://blogs.msdn.com/carloc/archive/2007/11/24/posters-posters-and-again-posters.aspx"&gt; To get it -- Click Here &lt;/a&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt; &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-2455188853748288548?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/2455188853748288548/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=2455188853748288548' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/2455188853748288548'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/2455188853748288548'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2008/04/visual-studio-posters-very-useful.html' title='Visual studio Posters!!!!! Very useful'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-5816654574177327971</id><published>2008-03-26T23:51:00.000-07:00</published><updated>2008-03-27T00:05:38.057-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio 2008'/><category scheme='http://www.blogger.com/atom/ns#' term='c# 3.0'/><title type='text'>C# 3.0 New language features</title><content type='html'>&lt;span style=";font-family:arial;font-size:100%;"  &gt;&lt;strong&gt;Automatic Properties&lt;/strong&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt;&lt;br /&gt;If you are a C# developer today, you are probably quite used to writing classes with basic properties like the code-snippet below:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt;&lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span style="color:black;"&gt;Person {&lt;br /&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;private string &lt;/span&gt;&lt;span style="color:black;"&gt;_firstName&lt;/span&gt;&lt;span style="color:blue;"&gt;;&lt;br /&gt;    private string &lt;/span&gt;&lt;span style="color:black;"&gt;_lastName&lt;/span&gt;&lt;span style="color:blue;"&gt;;&lt;br /&gt;    private int &lt;/span&gt;&lt;span style="color:black;"&gt;_age&lt;/span&gt;&lt;span style="color:blue;"&gt;;&lt;br /&gt;&lt;br /&gt;    public string &lt;/span&gt;&lt;span style="color:black;"&gt;FirstName {&lt;br /&gt;&lt;br /&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;get &lt;/span&gt;&lt;span style="color:black;"&gt;{&lt;br /&gt;            &lt;/span&gt;&lt;span style="color:blue;"&gt;return &lt;/span&gt;&lt;span style="color:black;"&gt;_firstName&lt;/span&gt;&lt;span style="color:blue;"&gt;;&lt;br /&gt;        &lt;/span&gt;&lt;span style="color:black;"&gt;}&lt;br /&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;set &lt;/span&gt;&lt;span style="color:black;"&gt;{&lt;br /&gt;            _firstName &lt;/span&gt;&lt;span style="color:blue;"&gt;= value;&lt;br /&gt;        &lt;/span&gt;&lt;span style="color:black;"&gt;}&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;public string &lt;/span&gt;&lt;span style="color:black;"&gt;LastName {&lt;br /&gt;&lt;br /&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;get &lt;/span&gt;&lt;span style="color:black;"&gt;{&lt;br /&gt;            &lt;/span&gt;&lt;span style="color:blue;"&gt;return &lt;/span&gt;&lt;span style="color:black;"&gt;_lastName&lt;/span&gt;&lt;span style="color:blue;"&gt;;&lt;br /&gt;        &lt;/span&gt;&lt;span style="color:black;"&gt;}&lt;br /&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;set &lt;/span&gt;&lt;span style="color:black;"&gt;{&lt;br /&gt;            _lastName &lt;/span&gt;&lt;span style="color:blue;"&gt;= value;&lt;br /&gt;        &lt;/span&gt;&lt;span style="color:black;"&gt;}&lt;br /&gt;    }   &lt;br /&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;public int &lt;/span&gt;&lt;span style="color:black;"&gt;Age {&lt;br /&gt;&lt;br /&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;get &lt;/span&gt;&lt;span style="color:black;"&gt;{&lt;br /&gt;            &lt;/span&gt;&lt;span style="color:blue;"&gt;return &lt;/span&gt;&lt;span style="color:black;"&gt;_age&lt;/span&gt;&lt;span style="color:blue;"&gt;;&lt;br /&gt;        &lt;/span&gt;&lt;span style="color:black;"&gt;}&lt;br /&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;set &lt;/span&gt;&lt;span style="color:black;"&gt;{&lt;br /&gt;            _age &lt;/span&gt;&lt;span style="color:blue;"&gt;= value;&lt;br /&gt;        &lt;/span&gt;&lt;span style="color:black;"&gt;}&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;p  style="font-family:times new roman;"&gt;&lt;span style="font-size:100%;"&gt;Note about that we aren't actually adding any logic in the getters/setters of our properties - instead we just get/set the value directly to a field.  This begs the question - then why not just use fields instead of properties?  Well - there are a lot of downsides to exposing public fields. Two of the big problems are: 1) you can't easily databind against fields, and 2) if you expose public fields from your classes you can't later change them to properties (for example: to add validation logic to the setters) without recompiling any assemblies compiled against the old class.  &lt;/span&gt;&lt;/p&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt; &lt;/span&gt;&lt;p  style="font-family:times new roman;"&gt;&lt;span style="font-size:100%;"&gt;The new C# compiler that ships in "Orcas" provides an elegant way to make your code more concise while still retaining the flexibility of properties using a new language feature called "automatic properties".  Automatic properties allow you to avoid having to manually declare a private field and write the get/set logic -- instead the compiler can automate creating the private field and the default get/set operations for you.  &lt;/span&gt;&lt;/p&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt; &lt;/span&gt;&lt;p  style="font-family:times new roman;"&gt;&lt;span style="font-size:100%;"&gt;For example, using automatic properties I can now re-write the code above to just be:&lt;/span&gt;&lt;/p&gt;&lt;p  style="font-family:times new roman;"&gt;&lt;span style="font-size:100%;"&gt;    &lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span style="color:black;"&gt;Person {&lt;br /&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;public string &lt;/span&gt;&lt;span style="color:black;"&gt;FirstName {&lt;br /&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;get; set;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color:black;"&gt;}&lt;br /&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;public string &lt;/span&gt;&lt;span style="color:black;"&gt;LastName {&lt;br /&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;get; set;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color:black;"&gt;}   &lt;br /&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;public int &lt;/span&gt;&lt;span style="color:black;"&gt;Age {&lt;br /&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;get; set;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color:black;"&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt;Or If I want to be really terse, I can collapse the whitespace even further like so:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt;    &lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span style="color:black;"&gt;Person {&lt;br /&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;public string &lt;/span&gt;&lt;span style="color:black;"&gt;FirstName { &lt;/span&gt;&lt;span style="color:blue;"&gt;get; set; &lt;/span&gt;&lt;span style="color:black;"&gt;}&lt;br /&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;public string &lt;/span&gt;&lt;span style="color:black;"&gt;LastName  { &lt;/span&gt;&lt;span style="color:blue;"&gt;get; set; &lt;/span&gt;&lt;span style="color:black;"&gt;}   &lt;br /&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;public int    &lt;/span&gt;&lt;span style="color:black;"&gt;Age       { &lt;/span&gt;&lt;span style="color:blue;"&gt;get; set; &lt;/span&gt;&lt;span style="color:black;"&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt;When the C# "Orcas" compiler encounters an empty get/set property implementation like above, it will now automatically generate a private field for you within your class, and implement a public getter and setter property implementation to it.  The benefit of this is that from a type-contract perspective, the class looks exactly like it did with our first (more verbose) implementation above.  This means that -- unlike public fields -- I can in the future add validation logic within my property setter implementation without having to change any external component that references my class.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt;&lt;strong&gt;Object Initializers&lt;br /&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt;Types within the .NET Framework rely heavily on the use of properties.  When instantiating and using new classes, it is very common to write code like below:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt; &lt;span style="color:black;"&gt;Person person &lt;/span&gt;&lt;span style="color:blue;"&gt;= new &lt;/span&gt;&lt;span style="color:black;"&gt;Person()&lt;/span&gt;&lt;span style="color:blue;"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;person.FirstName &lt;/span&gt;&lt;span style="color:blue;"&gt;= &lt;/span&gt;&lt;span style="color: rgb(128, 128, 128);"&gt;"Scott"&lt;/span&gt;&lt;span style="color:blue;"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;person.LastName &lt;/span&gt;&lt;span style="color:blue;"&gt;= &lt;/span&gt;&lt;span style="color: rgb(128, 128, 128);"&gt;"Guthrie"&lt;/span&gt;&lt;span style="color:blue;"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;person.Age &lt;/span&gt;&lt;span style="color:blue;"&gt;= &lt;/span&gt;&lt;span style="color:maroon;"&gt;32&lt;/span&gt;&lt;span style="color:blue;"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt;Have you ever wanted to make this more concise (and maybe fit on one line)?  With the C# and VB "Orcas" compilers you can now take advantage of a great "syntactic sugar" language feature called "object Initializers" that allows you to-do this and re-write the above code like so:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt; &lt;span style="color:black;"&gt;Person person &lt;/span&gt;&lt;span style="color:blue;"&gt;= new &lt;/span&gt;&lt;span style="color:black;"&gt;Person { FirstName&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&lt;span style="color: rgb(128, 128, 128);"&gt;"Scott"&lt;/span&gt;&lt;span style="color:black;"&gt;, LastName&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&lt;span style="color: rgb(128, 128, 128);"&gt;"Guthrie"&lt;/span&gt;&lt;span style="color:black;"&gt;, Age&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:maroon;"&gt;32 &lt;/span&gt;&lt;span style="color:black;"&gt;}&lt;/span&gt;&lt;span style="color:blue;"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;p  style="font-family:times new roman;"&gt;&lt;span style="font-size:100%;"&gt;The compiler will then automatically generate the appropriate property setter code that preserves the same semantic meaning as the previous (more verbose) code sample above.&lt;/span&gt;&lt;/p&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt; &lt;/span&gt;&lt;p  style="font-family:times new roman;"&gt;&lt;span style="font-size:100%;"&gt;In addition to setting simple property values when initializing a type, the object initializer feature allows us to optionally set more complex nested property types.  For example, assume each Person type we defined above also has a property called "Address" of type "Address".  We could then write the below code to create a new "Person" object and set its properties like so:&lt;/span&gt;&lt;/p&gt;&lt;p  style="font-family:times new roman;"&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p  style="font-family:times new roman;"&gt;&lt;span style="font-size:100%;"&gt;   &lt;span style="color:black;"&gt;Person person &lt;/span&gt;&lt;span style="color:blue;"&gt;= new &lt;/span&gt;&lt;span style="color:black;"&gt;Person {&lt;br /&gt;  FirstName &lt;/span&gt;&lt;span style="color:blue;"&gt;= &lt;/span&gt;&lt;span style="color: rgb(128, 128, 128);"&gt;"Scott"&lt;/span&gt;&lt;span style="color:black;"&gt;,&lt;br /&gt;  LastName &lt;/span&gt;&lt;span style="color:blue;"&gt;= &lt;/span&gt;&lt;span style="color: rgb(128, 128, 128);"&gt;"Guthrie"&lt;br /&gt;  &lt;/span&gt;&lt;span style="color:black;"&gt;Age &lt;/span&gt;&lt;span style="color:blue;"&gt;= &lt;/span&gt;&lt;span style="color:maroon;"&gt;32&lt;/span&gt;&lt;span style="color:black;"&gt;,&lt;br /&gt;  Address &lt;/span&gt;&lt;span style="color:blue;"&gt;= new &lt;/span&gt;&lt;span style="color:black;"&gt;Address {&lt;br /&gt;     Street &lt;/span&gt;&lt;span style="color:blue;"&gt;= &lt;/span&gt;&lt;span style="color: rgb(128, 128, 128);"&gt;"One Microsoft Way"&lt;/span&gt;&lt;span style="color:black;"&gt;,&lt;br /&gt;     City &lt;/span&gt;&lt;span style="color:blue;"&gt;= &lt;/span&gt;&lt;span style="color: rgb(128, 128, 128);"&gt;"Redmond"&lt;/span&gt;&lt;span style="color:black;"&gt;,&lt;br /&gt;     State &lt;/span&gt;&lt;span style="color:blue;"&gt;= &lt;/span&gt;&lt;span style="color: rgb(128, 128, 128);"&gt;"WA"&lt;/span&gt;&lt;span style="color:black;"&gt;,&lt;br /&gt;     Zip &lt;/span&gt;&lt;span style="color:blue;"&gt;= &lt;/span&gt;&lt;span style="color:maroon;"&gt;98052&lt;br /&gt;  &lt;/span&gt;&lt;span style="color:black;"&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;span style="color:blue;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt;&lt;strong&gt;Collection Initializers&lt;br /&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt;Object Initializers are great, and make it much easier to concisely add objects to collections.  For example, if I wanted to add three people to a generics-based List collection of type "Person", I could write the below code:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt;  &lt;span style="color:black;"&gt;List&lt;person&gt; people &lt;/person&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;= new &lt;/span&gt;&lt;span style="color:black;"&gt;List&lt;person&gt;()&lt;/person&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;;&lt;br /&gt;   &lt;br /&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;people.Add( &lt;/span&gt;&lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:black;"&gt;Person { FirstName &lt;/span&gt;&lt;span style="color:blue;"&gt;= &lt;/span&gt;&lt;span style="color: rgb(128, 128, 128);"&gt;"Scott"&lt;/span&gt;&lt;span style="color:black;"&gt;, LastName &lt;/span&gt;&lt;span style="color:blue;"&gt;= &lt;/span&gt;&lt;span style="color: rgb(128, 128, 128);"&gt;"Guthrie"&lt;/span&gt;&lt;span style="color:black;"&gt;, Age &lt;/span&gt;&lt;span style="color:blue;"&gt;= &lt;/span&gt;&lt;span style="color:maroon;"&gt;32 &lt;/span&gt;&lt;span style="color:black;"&gt;} )&lt;/span&gt;&lt;span style="color:blue;"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;people.Add( &lt;/span&gt;&lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:black;"&gt;Person { FirstName &lt;/span&gt;&lt;span style="color:blue;"&gt;= &lt;/span&gt;&lt;span style="color: rgb(128, 128, 128);"&gt;"Bill"&lt;/span&gt;&lt;span style="color:black;"&gt;, LastName &lt;/span&gt;&lt;span style="color:blue;"&gt;= &lt;/span&gt;&lt;span style="color: rgb(128, 128, 128);"&gt;"Gates"&lt;/span&gt;&lt;span style="color:black;"&gt;, Age &lt;/span&gt;&lt;span style="color:blue;"&gt;= &lt;/span&gt;&lt;span style="color:maroon;"&gt;50 &lt;/span&gt;&lt;span style="color:black;"&gt;} )&lt;/span&gt;&lt;span style="color:blue;"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;people.Add( &lt;/span&gt;&lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:black;"&gt;Person { FirstName &lt;/span&gt;&lt;span style="color:blue;"&gt;= &lt;/span&gt;&lt;span style="color: rgb(128, 128, 128);"&gt;"Susanne"&lt;/span&gt;&lt;span style="color:black;"&gt;, LastName &lt;/span&gt;&lt;span style="color:blue;"&gt;= &lt;/span&gt;&lt;span style="color: rgb(128, 128, 128);"&gt;"Guthrie"&lt;/span&gt;&lt;span style="color:black;"&gt;, Age &lt;/span&gt;&lt;span style="color:blue;"&gt;= &lt;/span&gt;&lt;span style="color:maroon;"&gt;32 &lt;/span&gt;&lt;span style="color:black;"&gt;} )&lt;/span&gt;&lt;span style="color:blue;"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;p  style="font-family:times new roman;"&gt;&lt;span style="font-size:100%;"&gt;Using the new Object Initializer feature alone saved 12 extra lines of code with this sample versus what I'd need to type with the C# 2.0 compiler.&lt;/span&gt;&lt;/p&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt; &lt;/span&gt;&lt;p style="font-family: times new roman;"&gt;&lt;span style="font-size:100%;"&gt;The C# and VB "Orcas" compilers allow us to go even further, though, and also now support "collection initializers" that allow us to avoid having multiple Add statements, and save even further keystrokes:&lt;/span&gt;&lt;/p&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt;   &lt;span style="color:black;"&gt;List&lt;person&gt; people &lt;/person&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;= new &lt;/span&gt;&lt;span style="color:black;"&gt;List&lt;person&gt; {&lt;br /&gt;  &lt;/person&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:black;"&gt;Person { FirstName &lt;/span&gt;&lt;span style="color:blue;"&gt;= &lt;/span&gt;&lt;span style="color: rgb(128, 128, 128);"&gt;"Scott"&lt;/span&gt;&lt;span style="color:black;"&gt;, LastName &lt;/span&gt;&lt;span style="color:blue;"&gt;= &lt;/span&gt;&lt;span style="color: rgb(128, 128, 128);"&gt;"Guthrie"&lt;/span&gt;&lt;span style="color:black;"&gt;, Age &lt;/span&gt;&lt;span style="color:blue;"&gt;= &lt;/span&gt;&lt;span style="color:maroon;"&gt;32 &lt;/span&gt;&lt;span style="color:black;"&gt;},&lt;br /&gt;  &lt;/span&gt;&lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:black;"&gt;Person { FirstName &lt;/span&gt;&lt;span style="color:blue;"&gt;= &lt;/span&gt;&lt;span style="color: rgb(128, 128, 128);"&gt;"Bill"&lt;/span&gt;&lt;span style="color:black;"&gt;, LastName &lt;/span&gt;&lt;span style="color:blue;"&gt;= &lt;/span&gt;&lt;span style="color: rgb(128, 128, 128);"&gt;"Gates"&lt;/span&gt;&lt;span style="color:black;"&gt;, Age &lt;/span&gt;&lt;span style="color:blue;"&gt;= &lt;/span&gt;&lt;span style="color:maroon;"&gt;50 &lt;/span&gt;&lt;span style="color:black;"&gt;},&lt;br /&gt;  &lt;/span&gt;&lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:black;"&gt;Person { FirstName &lt;/span&gt;&lt;span style="color:blue;"&gt;= &lt;/span&gt;&lt;span style="color: rgb(128, 128, 128);"&gt;"Susanne"&lt;/span&gt;&lt;span style="color:black;"&gt;, LastName &lt;/span&gt;&lt;span style="color:blue;"&gt;= &lt;/span&gt;&lt;span style="color: rgb(128, 128, 128);"&gt;"Guthrie"&lt;/span&gt;&lt;span style="color:black;"&gt;, Age &lt;/span&gt;&lt;span style="color:blue;"&gt;= &lt;/span&gt;&lt;span style="color:maroon;"&gt;32 &lt;/span&gt;&lt;span style="color:black;"&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;span style="color:blue;"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:arial;font-size:100%;"  &gt;When the compiler encounters the above syntax, it will automatically generate the collection insert code like the previous sample for us.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-5816654574177327971?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/5816654574177327971/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=5816654574177327971' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/5816654574177327971'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/5816654574177327971'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2008/03/c-30-new-language-features.html' title='C# 3.0 New language features'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-2604012916559776072</id><published>2008-03-26T03:52:00.000-07:00</published><updated>2008-03-26T05:56:19.376-07:00</updated><title type='text'>New Designer Support in Visual Studio 2008</title><content type='html'>Following video illustrates new features that are useful for developers as well as designers.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.asp.net/learn/3.5-videos/video-220.aspx"&gt;Click here !!!!!!!!&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-2604012916559776072?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/2604012916559776072/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=2604012916559776072' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/2604012916559776072'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/2604012916559776072'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2008/03/new-designer-support-in-visual-studio.html' title='New Designer Support in Visual Studio 2008'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-7678467687008759513</id><published>2008-03-25T02:57:00.000-07:00</published><updated>2008-03-25T03:42:32.004-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio Tips and Tricks'/><title type='text'>PowerCommands for Visual Studio 2008</title><content type='html'>&lt;span id="ctl00_ctl00_Content_TabContentPanel_Content_wikiSourceLabel"&gt; PowerCommands is a set of useful extensions for the Visual Studio 2008 adding additional functionality to various areas of the IDE. The source code is included and requires the VS SDK for VS 2008 to allow modification of functionality or as a reference to create additional custom PowerCommand extensions. Visit the VSX Developer Center at &lt;a linkindex="27" href="http://msdn.com/vsx" class="externalLink"&gt;http://msdn.com/vsx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; for more information about extending Visual Studio.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;b&gt;The Releases page contains download files (MSI installation file, readme document, and source code project).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_JBgTe5i3S6g/R-jNu__EY_I/AAAAAAAAAMA/tzm7LC6Wl50/s1600-h/PowerCommands.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp1.blogger.com/_JBgTe5i3S6g/R-jNu__EY_I/AAAAAAAAAMA/tzm7LC6Wl50/s400/PowerCommands.jpg" alt="" id="BLOGGER_PHOTO_ID_5181617578623394802" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span id="ctl00_ctl00_Content_TabContentPanel_Content_wikiSourceLabel"&gt;Below is a list of the included in PowerCommands for Visual Studio 2008 version 1.0. Refer to the Readme document which includes many additional screenshots.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Collapse Projects&lt;/b&gt;&lt;br /&gt;This command collapses a project or projects in the Solution Explorer starting from the root selected node. Collapsing a project can increase the readability of the solution. This command can be executed from three different places: solution, solution folders and project nodes respectively.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Copy Class&lt;/b&gt;&lt;br /&gt;This command copies a selected class entire content to the clipboard, renaming the class. This command is normally followed by a Paste Class command, which renames the class to avoid a compilation error. It can be executed from a single project item or a project item with dependent sub items.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Paste Class&lt;/b&gt;&lt;br /&gt;This command pastes a class entire content from the clipboard, renaming the class to avoid a compilation error. This command is normally preceded by a Copy Class command. It can be executed from a project or folder node.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Copy References&lt;/b&gt;&lt;br /&gt;This command copies a reference or set of references to the clipboard. It can be executed from the references node, a single reference node or set of reference nodes.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Paste References&lt;/b&gt;&lt;br /&gt;This command pastes a reference or set of references from the clipboard. It can be executed from different places depending on the type of project. For CSharp projects it can be executed from the references node. For Visual Basic and Website projects it can be executed from the project node.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Copy As Project Reference&lt;/b&gt;&lt;br /&gt;This command copies a project as a project reference to the clipboard. It can be executed from a project node.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Edit Project File&lt;/b&gt;&lt;br /&gt;This command opens the MSBuild project file for a selected project inside Visual Studio. It combines the existing Unload Project and Edit Project commands.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Open Containing Folder&lt;/b&gt;&lt;br /&gt;This command opens a Windows Explorer window pointing to the physical path of a selected item. It can be executed from a project item node&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Open Command Prompt&lt;/b&gt;&lt;br /&gt;This command opens a Visual Studio command prompt pointing to the physical path of a selected item. It can be executed from four different places: solution, project, folder and project item nodes respectively.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Unload Projects&lt;/b&gt;&lt;br /&gt;This command unloads all projects in a solution. This can be useful in MSBuild scenarios when multiple projects are being edited. This command can be executed from the solution node.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Reload Projects&lt;/b&gt;&lt;br /&gt;This command reloads all unloaded projects in a solution. It can be executed from the solution node.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Remove and Sort Usings&lt;/b&gt;&lt;br /&gt;This command removes and sort using statements for all classes given a project. It is useful, for example, in removing or organizing the using statements generated by a wizard. This command can be executed from a solution node or a single project node.&lt;br /&gt;Note: The Remove and Sort Usings feature is only available for C# projects since the C# editor implements this feature as a command in the C# editor (which this command calls for each .cs file in the project).&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Extract Constant&lt;/b&gt;&lt;br /&gt;This command creates a constant definition statement for a selected text. Extracting a constant effectively names a literal value, which can improve readability. This command can be executed from the code editor by right-clicking selected text.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Clear Recent File List&lt;/b&gt;&lt;br /&gt;This command clears the Visual Studio recent file list. The Clear Recent File List command brings up a Clear File dialog which allows any or all recent files to be selected.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Clear Recent Project List&lt;/b&gt;&lt;br /&gt;This command clears the Visual Studio recent project list. The Clear Recent Project List command brings up a Clear File dialog which allows any or all recent projects to be selected.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Transform Templates&lt;/b&gt;&lt;br /&gt;This command executes a custom tool with associated text templates items. It can be executed from a DSL project node or a DSL folder node.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Close All&lt;/b&gt;&lt;br /&gt;This command closes all documents. It can be executed from a document tab.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-7678467687008759513?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/7678467687008759513/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=7678467687008759513' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/7678467687008759513'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/7678467687008759513'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2008/03/powercommands-for-visual-studio-2008.html' title='PowerCommands for Visual Studio 2008'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp1.blogger.com/_JBgTe5i3S6g/R-jNu__EY_I/AAAAAAAAAMA/tzm7LC6Wl50/s72-c/PowerCommands.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-3404608036368526859</id><published>2008-03-24T02:50:00.000-07:00</published><updated>2008-03-24T04:39:55.409-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio 2008'/><title type='text'>Multi Targeting Support - Visual Studio 2008</title><content type='html'>&lt;h3&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;&lt;u&gt;What is Multi-Targeting?&lt;/u&gt;&lt;/span&gt;&lt;/h3&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt; &lt;/span&gt;&lt;p&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;With the past few releases of Visual Studio, each Visual Studio release only supported a specific version of the .NET Framework.  For example, VS 2002 only worked with .NET 1.0, VS 2003 only worked with .NET 1.1, and VS 2005 only worked with .NET 2.0.&lt;/span&gt;&lt;/p&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt; &lt;/span&gt;&lt;p&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;One of the big changes we are making starting with the VS 2008 release is to support what we call "Multi-Targeting" - which means that Visual Studio will now support targeting multiple versions of the .NET Framework, and developers will be able to start taking advantage of the new features Visual Studio provides without having to always upgrade their existing projects and deployed applications to use a new version of the .NET Framework library.&lt;/span&gt;&lt;/p&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt; &lt;/span&gt;&lt;p&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;Now when you open an existing project or create a new one with VS 2008, you can pick which version of the .NET Framework to work with - and the IDE will update its compilers and feature-set to match this.  Among other things, this means that features, controls, projects, item-templates, and assembly references that don't work with that version of the framework will be hidden, and when you build your application you'll be able to take the compiled output and copy it onto a machine that only has an older version of the .NET Framework installed, and you'll know that the application will work.&lt;/span&gt;&lt;/p&gt;&lt;h3&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;&lt;u&gt;Creating a New Project in VS 2008 that targets .NET 2.0&lt;/u&gt;&lt;/span&gt;&lt;/h3&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt; &lt;/span&gt;&lt;p&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;To see an example of multi-targeting in action on a recent build of VS 2008 Beta 2, we can select File-&gt;New Project to create a new application.  &lt;/span&gt;&lt;/p&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt; &lt;/span&gt;&lt;p&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;Notice below how in the top-right of the new project dialog there is now a dropdown that allows us to indicate which versions of the .NET Framework we want to target when we create the new project.  If I keep it selected on .NET Framework 3.5, I'll see a bunch of new project templates listed that weren't in previous versions of VS (including support for WPF client applications and WCF web service projects):&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_JBgTe5i3S6g/R-d8d7FdnFI/AAAAAAAAALA/zxQhzQxR6OE/s1600-h/step1.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp1.blogger.com/_JBgTe5i3S6g/R-d8d7FdnFI/AAAAAAAAALA/zxQhzQxR6OE/s400/step1.jpg" alt="" id="BLOGGER_PHOTO_ID_5181246749831699538" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=";font-family:arial;font-size:85%;"  &gt;If I change the dropdown to target .NET 2.0 instead, it will automatically filter the project list to only show those project templates supported on machines with the .NET 2.0 framework installed:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_JBgTe5i3S6g/R-eRPrFdnGI/AAAAAAAAALI/KykgX_FtK1o/s1600-h/step2.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp0.blogger.com/_JBgTe5i3S6g/R-eRPrFdnGI/AAAAAAAAALI/KykgX_FtK1o/s400/step2.jpg" alt="" id="BLOGGER_PHOTO_ID_5181269594762746978" border="0" /&gt;&lt;/a&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;If I create a new ASP.NET Web Application with the .NET 2.0 dropdown setting selected, it will create a new ASP.NET project whose compilation settings, assembly references, and web.config settings are configured to work with existing ASP.NET 2.0 servers:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_JBgTe5i3S6g/R-eRe7FdnHI/AAAAAAAAALQ/kWfJb5m3fFI/s1600-h/step3.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp1.blogger.com/_JBgTe5i3S6g/R-eRe7FdnHI/AAAAAAAAALQ/kWfJb5m3fFI/s400/step3.jpg" alt="" id="BLOGGER_PHOTO_ID_5181269856755752050" border="0" /&gt;&lt;/a&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;When you go to the control Toolbox, you'll see that only those controls that work on ASP.NET 2.0 are listed:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_JBgTe5i3S6g/R-eRsbFdnII/AAAAAAAAALY/3qGHU4S41v4/s1600-h/step5.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp3.blogger.com/_JBgTe5i3S6g/R-eRsbFdnII/AAAAAAAAALY/3qGHU4S41v4/s400/step5.jpg" alt="" id="BLOGGER_PHOTO_ID_5181270088683986050" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;And if you choose Add-&gt;Reference and bring up the assembly reference picker dialog, you'll see that those .NET class assemblies that aren't supported on .NET 2.0 are grayed out and can't be added to the project (notice how the "ok" button is not active below when I have a .NET 3.0 or .NET 3.5 assembly selected):&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_JBgTe5i3S6g/R-eR47FdnJI/AAAAAAAAALg/qyOEU6qepkQ/s1600-h/step4.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp1.blogger.com/_JBgTe5i3S6g/R-eR47FdnJI/AAAAAAAAALg/qyOEU6qepkQ/s400/step4.jpg" alt="" id="BLOGGER_PHOTO_ID_5181270303432350866" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;h3&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;u&gt;So why use VS 2008 if you aren't using the new .NET 3.5 features?&lt;/u&gt;&lt;/span&gt;&lt;/h3&gt;&lt;span style="font-family:arial;font-size:85%;"&gt; &lt;/span&gt;&lt;p&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;You might be wondering: "so what value do I get when using VS 2008 to work on a ASP.NET 2.0 project versus just using my VS 2005 today?"  Well, the good news is that you get a ton of tool-specific value with VS 2008 that you'll be able to take advantage of immediately with your existing projects without having to upgrade your framework/ASP.NET version.  A few big tool features in the web development space I think you'll really like include:&lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:arial;font-size:85%;"&gt; &lt;/span&gt;&lt;ol&gt;&lt;span style="font-family:arial;font-size:85%;"&gt; &lt;li&gt;JavaScript intellisense  &lt;/li&gt;&lt;li&gt;Much richer JavaScript debugging  &lt;/li&gt;&lt;li&gt;Nested ASP.NET master page support at design-time  &lt;/li&gt;&lt;li&gt;Rich CSS editing and layout support within the WYSIWYG designer  &lt;/li&gt;&lt;li&gt;Split-view designer support for having both source and design views open on a page at the same time  &lt;/li&gt;&lt;li&gt;A much faster ASP.NET page designer - with dramatic perf improvements in view-switches between source/design mode  &lt;/li&gt;&lt;li&gt;Automated .SQL script generation and hosting deployment support for databases on remote servers&lt;/li&gt;&lt;/span&gt;&lt;/ol&gt;&lt;span style="font-family:arial;font-size:85%;"&gt; &lt;/span&gt;&lt;p&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;You'll be able to use all of the above features with any version of the .NET Framework - without having to upgrade your project to necessarily target newer framework versions.  I'll be blogging about these features (as well as the great new framework features) over the next few weeks.&lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:arial;font-size:85%;"&gt; &lt;/span&gt;&lt;h3&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;u&gt;So how can I upgrade an existing project to .NET 3.5 later?&lt;/u&gt;&lt;/span&gt;&lt;/h3&gt;&lt;span style="font-family:arial;font-size:85%;"&gt; &lt;/span&gt;&lt;p&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;If at a later point you want to upgrade your project/site to target the NET 3.0 or NET 3.5 version of the framework libraries, you can right-click on the project in the solution explorer and pull up its properties page:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_JBgTe5i3S6g/R-eSHbFdnKI/AAAAAAAAALo/iAWzLcHfGec/s1600-h/step6.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp3.blogger.com/_JBgTe5i3S6g/R-eSHbFdnKI/AAAAAAAAALo/iAWzLcHfGec/s400/step6.jpg" alt="" id="BLOGGER_PHOTO_ID_5181270552540454050" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;You can change the "Target Framework" dropdown to select the version of the framework you want the project to target.  Doing this will cause VS to automatically update compiler settings and references for the project to use the correct framework version.  For example, it will by default add some of the new LINQ assemblies to your project, as well as add the new System.Web.Extensions assembly that ships in .NET 3.5 which delivers new ASP.NET controls/runtime features and provides built-in ASP.NET AJAX support (this means that you no longer need to download the separate ASP.NET AJAX 1.0 install - it is now just built-in with the .NET 3.5 setup):&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_JBgTe5i3S6g/R-eSVbFdnLI/AAAAAAAAALw/mhMYT1nt3Iw/s1600-h/step8.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp3.blogger.com/_JBgTe5i3S6g/R-eSVbFdnLI/AAAAAAAAALw/mhMYT1nt3Iw/s400/step8.jpg" alt="" id="BLOGGER_PHOTO_ID_5181270793058622642" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;Once you change your project's target version you'll also see new .NET 3.5 project item templates show up in your add-&gt;new items dialog, you'll be able to reference assemblies built against .NET 3.5, as well as see .NET 3.5 specific controls show up in your toolbox.  &lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:arial;font-size:85%;"&gt; &lt;/span&gt;&lt;p&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;For example, below you can now see the new &lt;asp:listview&gt; control (which is an awesome new control that provides the ability to do data reporting, editing, insert, delete and paging scenarios - with 100% control over the markup generated and no inline styles or other html elements), as well as the new &lt;asp:linqdatasource&gt; control (which enables you to easily bind and work against LINQ to SQL data models), and &lt;asp:datapager&gt; control show up under the "Data" section of our toolbox:&lt;/asp:datapager&gt;&lt;/asp:linqdatasource&gt;&lt;/asp:listview&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_JBgTe5i3S6g/R-eShLFdnMI/AAAAAAAAAL4/6OGY2fGmtvo/s1600-h/step9.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_JBgTe5i3S6g/R-eShLFdnMI/AAAAAAAAAL4/6OGY2fGmtvo/s400/step9.jpg" alt="" id="BLOGGER_PHOTO_ID_5181270994922085570" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;Note that in addition to changing your framework version "up" in your project properties dialog, you can also optionally take a project that is currently building against .NET 3.0 or 3.5 and change it "down" (for example: move it from .NET 3.5 to 2.0).  This will automatically remove the newer assembly references from your project, update your web.config file, and allow you to compile against the older framework (note: if you have code in the project that was written against the new APIs, obviously you'll need to change it).&lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:arial;font-size:85%;"&gt; &lt;/span&gt;&lt;h3&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;u&gt;What about .NET 1.0 and 1.1?&lt;/u&gt;&lt;/span&gt;&lt;/h3&gt;&lt;span style="font-family:arial;font-size:85%;"&gt; &lt;/span&gt;&lt;p&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;Unfortunately the VS 2008 multi-targeting support only works with .NET 2.0, .NET 3.0 and .NET 3.5 - and not against older versions of the framework.  The reason for this is that there were significant CLR engine changes between .NET 1.x and 2.x that make debugging very difficult to support.  In the end the costing of the work to support that was so large and impacted so many parts of Visual Studio that we weren't able to add 1.1 support in this release.  &lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:arial;font-size:85%;"&gt; &lt;/span&gt;&lt;p&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;VS 2008 does run side-by-side, though, with VS 2005, VS 2003, and VS 2002.  So it is definitely possible to continue targeting .NET 1.1 projects using VS 2003 on the same machine as VS 2008.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-3404608036368526859?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/3404608036368526859/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=3404608036368526859' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/3404608036368526859'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/3404608036368526859'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2008/03/multi-targeting-support-visual-studio.html' title='Multi Targeting Support - Visual Studio 2008'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp1.blogger.com/_JBgTe5i3S6g/R-d8d7FdnFI/AAAAAAAAALA/zxQhzQxR6OE/s72-c/step1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-4343236878565021653</id><published>2008-03-19T02:22:00.000-07:00</published><updated>2008-03-19T02:23:36.971-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio Tips and Tricks'/><title type='text'>Use explicit casting instead of DataBinder.Eval</title><content type='html'>&lt;p&gt;The &lt;a linkindex="5" href="http://msdn2.microsoft.com/en-us/library/4hx47hfe.aspx"&gt;DataBinder.Eval&lt;/a&gt; method uses .NET reflection to evaluate the arguments that are passed in and to return the results. Consider limiting the use of DataBinder.Eval during data binding operations in order to improve ASP.NET page performance.&lt;/p&gt; &lt;p&gt;Consider the following ItemTemplate element within a Repeater control using DataBinder.Eval:&lt;/p&gt;  &lt;div    style="background: white none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:Courier New;font-size:10pt;color:black;"&gt; &lt;p style="margin: 0px;"&gt;   &lt;span style="color:blue;"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color:blue;"&gt;&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;       &lt;span style="color:blue;"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;tr&lt;/span&gt;&lt;span style="color:blue;"&gt;&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;           &lt;span style="color:blue;"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;td&lt;/span&gt;&lt;span style="color:blue;"&gt;&gt;&lt;/span&gt;&lt;span style=";color:yellow;" &gt;&lt;%&lt;/span&gt;&lt;span style="color:blue;"&gt;#&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;DataBinder&lt;/span&gt;.Eval(Container.DataItem, &lt;span style="color: rgb(163, 21, 21);"&gt;"field1"&lt;/span&gt;) &lt;span style=";color:yellow;" &gt;%&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;!--&lt;/span--&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;td&lt;/span&gt;&lt;span style="color:blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;           &lt;span style="color:blue;"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;td&lt;/span&gt;&lt;span style="color:blue;"&gt;&gt;&lt;/span&gt;&lt;span style=";color:yellow;" &gt;&lt;%&lt;/span&gt;&lt;span style="color:blue;"&gt;#&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;DataBinder&lt;/span&gt;.Eval(Container.DataItem, &lt;span style="color: rgb(163, 21, 21);"&gt;"field2"&lt;/span&gt;) &lt;span style=";color:yellow;" &gt;%&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;!--&lt;/span--&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;td&lt;/span&gt;&lt;span style="color:blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;       &lt;span style="color:blue;"&gt;&lt;!--&lt;/span--&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;&lt;tr&lt;/span&gt;&lt;span style="color:blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;   &lt;span style="color:blue;"&gt;&lt;!--&lt;/span--&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;&lt;itemtemplate&lt;/span&gt;&lt;span style="color:blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;Using explicit casting offers better performance by avoiding the cost of .NET reflection. Cast the Container.DataItem as a DataRowView:&lt;/p&gt;  &lt;div    style="background: white none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:Courier New;font-size:10pt;color:black;"&gt; &lt;p style="margin: 0px;"&gt;   &lt;span style="color:blue;"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color:blue;"&gt;&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;       &lt;span style="color:blue;"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;tr&lt;/span&gt;&lt;span style="color:blue;"&gt;&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;           &lt;span style="color:blue;"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;td&lt;/span&gt;&lt;span style="color:blue;"&gt;&gt;&lt;/span&gt;&lt;span style=";color:yellow;" &gt;&lt;%&lt;/span&gt;&lt;span style="color:blue;"&gt;#&lt;/span&gt; ((&lt;span style="color: rgb(43, 145, 175);"&gt;DataRowView&lt;/span&gt;)Container.DataItem)[&lt;span style="color: rgb(163, 21, 21);"&gt;"field1"&lt;/span&gt;] &lt;span style=";color:yellow;" &gt;%&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;!--&lt;/span--&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;td&lt;/span&gt;&lt;span style="color:blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;           &lt;span style="color:blue;"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;td&lt;/span&gt;&lt;span style="color:blue;"&gt;&gt;&lt;/span&gt;&lt;span style=";color:yellow;" &gt;&lt;%&lt;/span&gt;&lt;span style="color:blue;"&gt;#&lt;/span&gt; ((&lt;span style="color: rgb(43, 145, 175);"&gt;DataRowView&lt;/span&gt;)Container.DataItem)[&lt;span style="color: rgb(163, 21, 21);"&gt;"field2"&lt;/span&gt;] &lt;span style=";color:yellow;" &gt;%&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;!--&lt;/span--&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;td&lt;/span&gt;&lt;span style="color:blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;       &lt;span style="color:blue;"&gt;&lt;!--&lt;/span--&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;tr&lt;/span&gt;&lt;span style="color:blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;   &lt;span style="color:blue;"&gt;&lt;!--&lt;/span--&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color:blue;"&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-4343236878565021653?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/4343236878565021653/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=4343236878565021653' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/4343236878565021653'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/4343236878565021653'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2008/03/use-explicit-casting-instead-of.html' title='Use explicit casting instead of DataBinder.Eval'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-7693707670914431987</id><published>2008-03-19T02:20:00.000-07:00</published><updated>2008-03-19T02:21:35.168-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio Tips and Tricks'/><title type='text'>When returning DataReader from a function, specify CommandBehavior.CloseConnection</title><content type='html'>&lt;p&gt;When you create an ADO.NET &lt;strong&gt;DataReader&lt;/strong&gt; object, specify the &lt;strong&gt;CommandBehavior.CloseConnection&lt;/strong&gt; enumeration in your call to &lt;strong&gt;ExecuteReader&lt;/strong&gt;. This ensures that when you close the &lt;strong&gt;DataReader&lt;/strong&gt;, the SQL connection is also closed. This is especially helpful when you return a &lt;strong&gt;DataReader&lt;/strong&gt; from a function, and you do not have control over the calling code. If the caller forgets to close the connection but closes the reader, both are closed when the &lt;strong&gt;DataReader&lt;/strong&gt; is created by using &lt;strong&gt;CommandBehavior.CloseConnection&lt;/strong&gt;. This is shown in the following code fragment.&lt;/p&gt;  &lt;div style="background: white none repeat scroll 0% 50%; font-family: Courier New; font-size: 10pt; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt; &lt;p style="margin: 0px;"&gt;    &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;SqlDataReader&lt;/span&gt; CustomerRead(&lt;span style="color: blue;"&gt;int&lt;/span&gt; CustomerID)&lt;/p&gt; &lt;p style="margin: 0px;"&gt;    {&lt;/p&gt; &lt;p style="margin: 0px;"&gt;        &lt;span style="color: green;"&gt;//... create connection and command, open connection&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;        &lt;span style="color: blue;"&gt;return&lt;/span&gt; myCommand.ExecuteReader(&lt;span style="color: rgb(43, 145, 175);"&gt;CommandBehavior&lt;/span&gt;.CloseConnection);&lt;/p&gt; &lt;p style="margin: 0px;"&gt;    }&lt;/p&gt; &lt;p style="margin: 0px;"&gt; &lt;/p&gt; &lt;p style="margin: 0px;"&gt;    &lt;span style="color: green;"&gt;//... client code&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;    &lt;span style="color: rgb(43, 145, 175);"&gt;SqlDataReader&lt;/span&gt; myReader = CustomerRead(10248);&lt;/p&gt; &lt;p style="margin: 0px;"&gt;    &lt;span style="color: green;"&gt;//... read some data&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px;"&gt;    myReader.Close(); &lt;span style="color: green;"&gt;// reader and connection are closed&lt;/span&gt;&lt;/p&gt; &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-7693707670914431987?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/7693707670914431987/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=7693707670914431987' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/7693707670914431987'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/7693707670914431987'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2008/03/when-returning-datareader-from-function.html' title='When returning DataReader from a function, specify CommandBehavior.CloseConnection'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-4446430123041941392</id><published>2008-03-19T02:14:00.000-07:00</published><updated>2008-03-19T02:17:28.393-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio Tips and Tricks'/><title type='text'>Add Windows Explorer to your Visual Studio tools menu</title><content type='html'>I often need to open Windows Explorer and browse to the current file, folder, or project that I am working on in Visual Studio. This tip allows you to achieve this by clicking "Windows Explorer" in the Tools menu, and is one of the most simple-yet-useful tips I know of. &lt;p&gt;To set it up, click &lt;strong&gt;Tools&lt;/strong&gt;, then &lt;strong&gt;External Tools...&lt;/strong&gt;, then click &lt;strong&gt;Add&lt;/strong&gt;.  Now enter the following data:&lt;br /&gt;Title: Windows Explorer&lt;br /&gt;Command: explorer.exe&lt;br /&gt;Arguments: /select,"$(ItemPath)"&lt;/p&gt; &lt;p&gt;Leave &lt;strong&gt;Initial directoy&lt;/strong&gt; blank, and click &lt;strong&gt;OK&lt;/strong&gt;.  Now when you click &lt;strong&gt;Tools&lt;/strong&gt;, &lt;strong&gt;Windows Explorer&lt;/strong&gt;, Windows Explorer will open with the current file you are editing selected.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-4446430123041941392?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/4446430123041941392/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=4446430123041941392' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/4446430123041941392'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/4446430123041941392'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2008/03/add-windows-explorer-to-your-visual.html' title='Add Windows Explorer to your Visual Studio tools menu'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-4138011995818096847</id><published>2008-03-18T03:53:00.000-07:00</published><updated>2008-03-18T03:54:36.539-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio 2008'/><title type='text'>Utility to Convert Text / HTML to a Visual Basic String</title><content type='html'>&lt;p&gt;AJAX opens many interesting new doors in terms of how we can tailor the user experience to the customers needs and how we can display content based on any number of state context.&lt;/p&gt; &lt;p&gt;This sometimes means fetching and manipulating HTML or XML in our server side code and sending it to the browser as execution time via an AJAX request.&lt;/p&gt; &lt;p&gt;This is the best utility which convert your Text/ HTML code in String that we can utilize at server side code.&lt;/p&gt; &lt;p&gt;[&lt;a href="http://www.softpedia.com/progDownload/Text-to-VB-String-Download-29794.html" mce_href="http://www.softpedia.com/progDownload/Text-to-VB-String-Download-29794.html" target="_blank"&gt;Just Click Here to get your copy - it's free&lt;/a&gt;.]&lt;/p&gt; &lt;p&gt;&lt;a href="http://priyangpatel.wordpress.com/2008/03/14/utility-to-convert-text-html-to-a-visual-basic-string/text-html-to-vb-string/" mce_href="http://priyangpatel.wordpress.com/2008/03/14/utility-to-convert-text-html-to-a-visual-basic-string/text-html-to-vb-string/" rel="attachment wp-att-11" title="Text/ Html To VB string"&gt;&lt;img src="http://priyangpatel.wordpress.com/files/2008/03/imageaxd.png" mce_src="http://priyangpatel.wordpress.com/files/2008/03/imageaxd.png" alt="Text/ Html To VB string" height="391" width="456" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-4138011995818096847?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/4138011995818096847/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=4138011995818096847' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/4138011995818096847'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/4138011995818096847'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2008/03/utility-to-convert-text-html-to-visual.html' title='Utility to Convert Text / HTML to a Visual Basic String'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-1162075254468023437</id><published>2008-03-18T03:52:00.001-07:00</published><updated>2008-03-18T03:54:54.767-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio 2008'/><title type='text'>Free Microsoft Press E- Books Offer !!!!!!</title><content type='html'>&lt;p&gt;Get visual studio 2008 Ebooks, you can explore first chapter's online.&lt;/p&gt; &lt;a href="http://csna01.libredigital.com/?urvs5cn3s8" mce_href="http://csna01.libredigital.com/?urvs5cn3s8" title="Get it its free!! Click Here" target="_blank"&gt;Get it its free!!! Click Here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-1162075254468023437?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/1162075254468023437/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=1162075254468023437' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/1162075254468023437'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/1162075254468023437'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2008/03/free-microsoft-press-e-books-offer.html' title='Free Microsoft Press E- Books Offer !!!!!!'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-3983899672025929381</id><published>2008-03-18T03:48:00.000-07:00</published><updated>2008-03-18T03:51:55.129-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio 2008'/><title type='text'>Connect Apps with WCF</title><content type='html'>Learn when and how to utilize Windows Communication Foundation to develop and  maintain your communications layer when creating a loosely coupled, scalable,  interoperable services-oriented application.&lt;br /&gt;&lt;br /&gt;&lt;span id="intelliTXT"&gt;&lt;i&gt;Technology Toolbox: C#, Other: Windows Communication  Foundation&lt;/i&gt;  &lt;p&gt;Windows Communication Foundation (WCF) is a powerful new technology for  building services-oriented architecture (SOA)-based applications. The usefulness  of WCF goes well beyond large-scale enterprise SOAs. WCF can be used even for  simple scenarios where all you need is connectivity between two apps on the same  machine or across processes on different machines, even if you haven't adopted  the full architectural approach of SOA.&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;In this article, I'll discuss some best practices and things to keep in mind  when applying WCF in the real world. I'll start with a quick review of the  basics of connecting applications with WCF, and then focus on several areas  where you have to make hard choices between creating an  easy-to-develop-and-maintain communications layer or creating a loosely coupled,  scalable, interoperable SOA-based application. I'll also emphasize a collection  of best practices, describing the context of where those practices would apply  and why they're important.   &lt;p&gt;You can use WCF to get two different chunks of code talking to each other  across a wide variety of connectivity scenarios. With WCF, you can create a  full-blown SOA-based application that communicates across the open Internet with  another service written in a completely different technology. You can also use  it to get two classes in the same assembly in the same process talking to one  another. In general, you should consider using WCF for any new code where you  need to cross a process boundary, and even in some scenarios for connecting  decoupled objects (as services) within the same process. Basically, you should  forget that .NET Remoting, ASP.NET Web Services, and Enterprise Services exist  (except for maintaining legacy code written in those technologies), and focus on  WCF for all your connectivity needs. &lt;/p&gt; &lt;p&gt;Connecting two pieces of code with WCF requires that you implement five  elements on the server side. &lt;/p&gt; &lt;p&gt;First, you need a service contract. This defines what operations you expose  at the service boundary, as well as the data that is passed through those  operations. &lt;/p&gt; &lt;p&gt;Second, you need data contracts for complex types passed through the service  contract operations. These contracts define the shape of the sent data so that  it can be consumed or produced by the client. &lt;/p&gt; &lt;p&gt;Third, you need a service implementation. This provides the functional code  that answers the incoming service messages and decides what to do with them.  &lt;/p&gt; &lt;p&gt;The fourth required element is a service configuration. This specifies how  the service is exposed, in terms of its address, binding, and contract. Wrapped  up in the binding are all the gory details of what network protocol you're  using, the encoding of the message, the security mechanisms being used, and  whether you're using reliability, transactions, or several other features that  WCF supports. &lt;/p&gt; &lt;p&gt;Finally, you must have a service host. This is the process where the service  runs. Your service host can be any .NET process if you want to self-host it,  IIS, or Windows Activation Service (WAS) for Windows Vista and Windows Server  2008. &lt;/p&gt; &lt;p&gt;On the client side, you need to implement three different technologies to  make service calls with WCF (whether the service is a WCF service or one  implemented in some other technology): a service contract definition that  matches what the server uses, a data contract definition that matches what the  server is using, and a proxy that can form the messages to send to the service  and process returned messages. &lt;/p&gt; &lt;p&gt;There are many different ways that you can use WCF, depending on the scenario  and requirements; however, there are a number of best practices you should keep  in mind as you design your WCF back-end services.&lt;br /&gt;&lt;/p&gt;&lt;span id="intelliTXT"&gt;&lt;p&gt;&lt;b&gt;Use Service Boundary Best Practices&lt;/b&gt;&lt;br /&gt;Layering is a good idea in any  application. You should already be familiar with the benefits of separating  functionality into a presentation layer, business layer, and data access layer.  Layering provides separation of concerns and better factoring of code, which  gives you better maintainability and the ability to split layers out into  separate physical tiers for scalability. In the same way that data access code  should be separated into its own layer that focuses on translating between the  world of the database and the application domain, services should be placed in a  separate service layer that focuses on translating between the services-oriented  external world and the application domain (see &lt;a href="http://visualstudiomagazine.com/listings/list.aspx?id=275" target="_blank"&gt;Figure 1&lt;/a&gt;). &lt;/p&gt; &lt;p&gt;Having a service layer implies that you've put your service definitions into  a separate class library, and host that library in your service host  environment. The service layer dispatches calls into the business layer to get  the work of the service operation done. &lt;/p&gt; &lt;p&gt;WCF supports putting your service contract and operation contract attributes  directly in the implementation class, but you should always avoid doing so.  Having an interface definition that clearly defines what the service boundary  looks like, separate from the implementation of that service, is preferable.  &lt;/p&gt; &lt;p&gt;For example, you might implement a simple service contract definition like  this: &lt;/p&gt;&lt;pre class="codesnippet"&gt;[ServiceContract()]&lt;br /&gt;public interface IProductService&lt;br /&gt;{&lt;br /&gt; [OperationContract()]&lt;br /&gt; List&lt;consumerproduct&gt; GetProducts();&lt;br /&gt;}&lt;/consumerproduct&gt;&lt;/pre&gt; &lt;p&gt;An important aspect of SOA design is hiding all the details of the  implementation behind the service boundary. This includes revealing or dictating  what particular technology was used. It also means you shouldn't assume the  consuming application supports a complex object model. Part of the service  boundary definition is the data contract definition for the complex types that  will be passed as operation parameters or return values. &lt;/p&gt; &lt;p&gt;For maximum interoperability and alignment with SOA principles, you should  not pass .NET-specific types, such as DataSets or Exceptions, across the service  boundary. You should stick to fairly simple data structure objects such as  classes with properties and backing member fields. You can pass objects that  have nested complex types such as a Customer with an Order collection, but you  shouldn't make any assumptions about the consumer being able to support  object-oriented constructs like interfaces or base classes for interoperable Web  services. &lt;/p&gt; &lt;p&gt;However, if you're using WCF only as a new remoting technology to get two  different pieces of code to talk to each other across processes, with no  expectation or requirement for others to write consuming applications, then you  can pass whatever you want as a data contract. You just have to make sure that  those types are marked appropriately as data contracts or are serializable  types. Generally speaking, you face various challenges when passing DataSets  through WCF services, so you should avoid doing so, except for simple scenarios.  If you do want to pursue using DataSets with WCF, you should definitely use  typed DataSets and try to stick to individualy typed DataTables as parameters or  return types. &lt;/p&gt; &lt;p&gt;Note that the simple service contract described previously is defined in  terms of List&lt;consumerproduct&gt;. WCF is designed to flatten enumerable  collections into arrays at the service boundary. Rather than limiting  interoperability, this feature makes your life easier when populating and using  your collections in the service and business layers. &lt;/consumerproduct&gt;&lt;/p&gt; &lt;p&gt;For example, consider this data contract definition for the ConsumerProduct  type: &lt;/p&gt;&lt;pre class="codesnippet"&gt;[DataContract()]&lt;br /&gt;public class ConsumerProduct&lt;br /&gt;{&lt;br /&gt;    private int m_ProductID;&lt;br /&gt;    private string m_ProductName;&lt;br /&gt;    private double m_UnitPrice;&lt;br /&gt;&lt;br /&gt;    [DataMember()]&lt;br /&gt;    public int ProductID&lt;br /&gt;    {&lt;br /&gt;       get { return m_ProductID; }&lt;br /&gt;       set { m_ProductID = value; }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    [DataMember()]&lt;br /&gt;    public string ProductName&lt;br /&gt;    {&lt;br /&gt;       get {return m_ProductName; }&lt;br /&gt;       set{ m_ProductName = value; }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    [DataMember()]&lt;br /&gt;    public double UnitPrice&lt;br /&gt;    {&lt;br /&gt;       get {return m_UnitPrice; }&lt;br /&gt;       set { m_UnitPrice = value; }&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt; &lt;p&gt;&lt;b&gt;Use Per-Call Instancing&lt;/b&gt;&lt;br /&gt;Another important best practice to adhere  to: Services should use per-call instancing as a default. WCF supports three  instancing modes for services: Per-Call, Per-Session, and &lt;/p&gt; &lt;p&gt;Single. Per-Call creates a new instance of the service implementation class  for each operation call that comes into the service and disposes of it when the  service operation is &lt;/p&gt; &lt;p&gt;complete. This is the most scalable and robust option, so it's unfortunate  that the WCF product team decided to change from this being the default  instancing mode shortly before release of the product. Per-Session allows a  single client to keep a service instance alive on the server as long as the  client keeps making calls into that instance. This allows you to store state in  member variables of the service instance between calls and have an ongoing,  stateful conversation between a client application and a server object. However,  it has several messy side effects, including the fact that consuming memory on a  server when it isn't actively in use is bad for scalability. It also gets messy  when transactions are involved. Single(ton) allows you to have all calls from  all clients routed to a single service instance on the back-end. This allows you  to use that single point of entry as a gatekeeper if your requirements dictate  the need for such a thing. Using the Singleton mode is even worse for  scalability because all calls into the singleton instance are serialized (one  caller at a time) by default. Single mode also has some of the same side effects  as sessionful services. That said, there are specific scenarios where using  Per-Session or Single makes sense. &lt;/p&gt; &lt;p&gt;You should try to design your services as Per-Call initially because it's the  cleanest, most scalable, and safest option, and only talk yourself into using  Per-Session or Singleton if you understand the implications of using those  modes. &lt;/p&gt; &lt;p&gt;This code declares a Per-Call service for the service contract illustrated  previously: &lt;/p&gt;&lt;pre class="codesnippet"&gt;[ServiceBehavior(&lt;br /&gt; InstanceContextMode=&lt;br /&gt; InstanceContextMode.PerCall)]&lt;br /&gt;public class ProductService :&lt;br /&gt; IProductService&lt;br /&gt;{&lt;br /&gt; List&lt;consumerproduct&gt;&lt;br /&gt;    IProductService.GetProducts()&lt;br /&gt; {&lt;br /&gt;    ...&lt;br /&gt; }&lt;br /&gt;}&lt;/consumerproduct&gt;&lt;/pre&gt; &lt;p&gt;I recommend checking out "Programming WCF Services" by Juval Löwy (O'Reilly,  2007) for a better understanding of the differences between--and implications  of--Per-Session and Single instancing modes (see Additional Resources). &lt;/p&gt; &lt;p&gt;&lt;b&gt;Deal with Exceptions&lt;/b&gt;&lt;br /&gt;If an unhandled exception reaches the service  boundary, WCF will catch that exception and return a SOAP fault to the caller.  By default, that fault is opaque and doesn't reveal any details about what the  real problem was on the back-end. This is good and aligns with SOA design  principles. You should only reveal information to the client that you choose to  expose, and avoid exposing details like stack traces and the like that would go  with a normal exception delivery. &lt;/p&gt; &lt;p&gt;However, for most bindings in WCF, WCF will also fault the channel when an  unhandled exception reaches the service boundary, which usually means you cannot  make subsequent calls through the same proxy on the client side, and you will  have to establish a new connection to the server. As a result, one of your  responsibilities in designing a good service layer is to catch all exceptions  and throw a FaultException&lt;t&gt; exception to WCF in cases when the service  could recover from the exception and answer subsequent calls without causing  follow-on problems. &lt;/t&gt;&lt;/p&gt; &lt;p&gt;FaultException&lt;t&gt; is a special type that still propagates as an  Exception on the .NET call stack, but is interpreted differently by the WCF  layer that performs the messaging. Think of it as a handled exception that  you're throwing to WCF, as opposed to an unhandled exception that propagates  into WCF on its own without your service intervening. You can pass non-detailed  information to the client about what the problem was by using the Reason  property on FaultException&lt;t&gt;. If a FaultException&lt;t&gt; is caught by  WCF, it will still package it as a SOAP fault message, but it will not fault the  channel. That means you can instruct the client to handle the resulting error  and keep calling the service without needing to open a new connection. &lt;/t&gt;&lt;/t&gt;&lt;/t&gt;&lt;/p&gt; &lt;p&gt;There are many different scenarios for dealing with exceptions in WCF, as  well as several ways to hook up your exception handling in the service layer.  &lt;/p&gt; &lt;p&gt;Some basic rules you should follow include: Catch unhandled exceptions and  throw a FaultException&lt;t&gt; if your service is able to recover and answer  subsequent calls without causing further problems (which it should be able to do  if you designed it as a per-call service); don't send exception details to the  client except for debugging purposes during development; and pass non-detailed  exception information to the client using the Reason property on  FaultException&lt;t&gt;. &lt;/t&gt;&lt;/t&gt;&lt;/p&gt; &lt;p&gt;This service method captures a particular exception type and returns  non-detailed information about the problem to the client through  FaultException&lt;t&gt;: &lt;/t&gt;&lt;/p&gt;&lt;pre class="codesnippet"&gt;List&lt;consumerproduct&gt;&lt;br /&gt; IProductService.GetProducts()&lt;br /&gt;{&lt;br /&gt; try&lt;br /&gt; {&lt;br /&gt;    ...&lt;br /&gt; }&lt;br /&gt; catch (SqlException ex)&lt;br /&gt; {&lt;br /&gt;    throw new FaultException&lt;string&gt;(&lt;br /&gt;    "The service could not connect to the data store",&lt;br /&gt;       // details argument&lt;br /&gt;    "Unknown error");&lt;br /&gt;       // Reason&lt;br /&gt; }&lt;br /&gt;}&lt;/string&gt;&lt;/consumerproduct&gt;&lt;/pre&gt; &lt;p&gt;The T type parameter can be any type you want, but for interoperability, you  will probably want to stick to a simple data structure that is marked as a data  contract or types that are serializable. &lt;/p&gt; &lt;p&gt;For small-scale services where you will be the only one writing the client  applications, you can choose to wrap the caught exception type in a  FaultException&lt;t&gt; (for example,  FaultException&lt;invalidoperationexception&gt;) so that the client gets the  full details of the exception, but you don't fault the channel. &lt;/invalidoperationexception&gt;&lt;/t&gt;&lt;/p&gt; &lt;p&gt;Michele Leroux Bustamante's book, "Learning WCF" (O'Reilly, 2007), provides  good coverage of exception handling in WCF (see Additional Resources). &lt;/p&gt; &lt;p&gt;&lt;b&gt;Choose an Appropriate Service Host&lt;/b&gt;&lt;br /&gt;Windows Communication Foundation  has three options for hosting your services. You can be self-hosted (run your  services in any .NET application that you design), IIS-hosted, or Windows  Activation Service (WAS)-hosted. &lt;/p&gt; &lt;p&gt;Self-hosting gives you the most flexibility because you set up the hosting  environment yourself. This means you can access and configure your service host  programmatically and do other things like hook up to service host events for  operations monitoring and control. However, self-hosting puts the responsibility  for process management and other configuration options squarely on your  shoulders. &lt;/p&gt; &lt;p&gt;This code describes a simple Windows Service self-hosting setup: &lt;/p&gt;&lt;pre class="codesnippet"&gt;public partial class&lt;br /&gt; MyNTServiceHost : ServiceBase&lt;br /&gt;{&lt;br /&gt; ServiceHost m_ProductServiceHost = null;&lt;br /&gt; public MyNTServiceHost()&lt;br /&gt; {&lt;br /&gt;    InitializeComponent();&lt;br /&gt; }&lt;br /&gt; protected override void OnStart(string[] args)&lt;br /&gt; {&lt;br /&gt;    m_ProductServiceHost = new&lt;br /&gt;       ServiceHost(typeof(ProductService));&lt;br /&gt;    m_ProductServiceHost.Open();&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; protected override void OnStop()&lt;br /&gt; {&lt;br /&gt;    if (m_ProductServiceHost != null)&lt;br /&gt;       m_ProductServiceHost.Close();&lt;br /&gt; }&lt;br /&gt;}&lt;/pre&gt; &lt;p&gt;IIS-hosting allows you to deploy your services to IIS by dropping the DLLs  into the \Bin directory and putting .SVC files as the service addressable  endpoints. You gain the kernel-level request routing of IIS, the IIS management  consoles for configuring the hosting environment, IIS's ability to start and  recycle worker processes, and more. The big downside to IIS-hosting is that  you're stuck with HTTP-based bindings only. &lt;/p&gt; &lt;p&gt;WAS is a part of IIS 7 (Windows Vista and Windows Server 2008) and gives you  the hosting model of IIS. However, it also allows you to expose services using  protocols other than HTTP, such as TCP, Named Pipes, and MSMQ. &lt;/p&gt; &lt;p&gt;WAS is almost always the best choice if you're targeting newer platforms. If  you're exposing services outside your network, you will probably be using HTTP  protocols anyway, so IIS-hosting is usually best for externally exposed  services. &lt;/p&gt; &lt;p&gt;If WAS-hosting isn't an option for services running inside the intranet, you  should plan on self-hosting to take advantage of other (faster and more capable)  protocols inside the firewall, as well as to give you more flexibility when  configuring your environment programmatically. &lt;/p&gt; &lt;p&gt;&lt;b&gt;Use Callbacks Properly&lt;/b&gt;&lt;br /&gt;WCF includes a capability to call back a  client to return data to it asynchronously or as a form of event notification.  This is handy when you want to signal the client that a long-running operation  has completed on the back-end, or to notify a client of changing data that  affects it. To do this, you must define a callback contract that is paired with  your service contract. The client doesn't have to expose that callback contract  publicly as a service to the outside world, but the service can use it to call  back to the client after an initial call has been made into the service by the  client. This code creates a service contract definition with a paired callback  contract: &lt;/p&gt;&lt;pre class="codesnippet"&gt;[ServiceContract(CallbackContract&lt;br /&gt; =typeof(IProductServiceCallback))]&lt;br /&gt;public interface IProductService&lt;br /&gt;{&lt;br /&gt; [OperationContract()]&lt;br /&gt; List&lt;consumerproduct&gt;&lt;br /&gt;    GetProducts();&lt;br /&gt;&lt;br /&gt; [OperationContract()]&lt;br /&gt; void SubscribeProductChanges();&lt;br /&gt;&lt;br /&gt; [OperationContract()]&lt;br /&gt; void UnsubscribeProductChanges();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public interface IProductServiceCallback&lt;br /&gt;{&lt;br /&gt; [OperationContract()]&lt;br /&gt; void ProductChanged(ConsumerProduct product);&lt;br /&gt;}&lt;/consumerproduct&gt;&lt;/pre&gt; &lt;p&gt;If you intend to use callbacks, it's a good idea to expose a  subscribe/unsubscribe API as part of the service contract. To perform callbacks,  the service must capture a callback context from an incoming call, and then hold  that context in memory until the point when a call is made back to the client.  The client also needs to create an object that implements the callback interface  to receive the incoming calls from the service, and must keep that object and  the same proxy alive as long as callbacks are expected. This sets up a fairly  tightly coupled communications pattern between the client and the service  (including object lifetime dependencies), so it's a good idea to let the client  control exactly when that tight coupling begins and ends through explicit  service calls to start and end the conversation. &lt;/p&gt; &lt;p&gt;The biggest limitations of callbacks are that they don't scale   and might  not work in interop scenarios. The scaling problem is related to the fact that  the service must hold a reference to the client in memory and perform the  callbacks on that reference. &lt;a href="http://visualstudiomagazine.com/listings/list.aspx?id=274" target="_blank"&gt;Listing 1&lt;/a&gt; contains code that illustrates how to capture,  store, and change notification to the client through a callback reference for a  service. &lt;/p&gt; &lt;p&gt;You also face an interop problem related to the fact that the callback  mechanism in WCF is based on a proprietary technology with no ratified standard.  It's proprietary, but at least it's expressed through things in the SOAP message  that could be consumed and used properly by other technologies. However, if  interop is a part of your requirements, you should avoid callbacks. &lt;/p&gt; &lt;p&gt;The alternatives are to set up a polling API where a client can come and ask  for changes at appropriate intervals, or you can set up a publish-subscribe  middleman service to act as a broker for subscriptions and publications to avoid  coupling the client and the service and to keep them scalable. You can find an  example of how to do this in the appendix of "Programming WCF Services" (see  Additional Resources). &lt;/p&gt; &lt;p&gt;&lt;b&gt;Use Maintainable Proxy Code&lt;/b&gt;&lt;br /&gt;One of the tenets of service  orientation is that you should share schema and contract, not types. So, to keep  a client as decoupled as possible from a service definition, you shouldn't share  any types between the service and the client that aren't part of the service  boundary. However, if you're writing both the service and the client, you don't  want to have to maintain two type definitions for the same thing. &lt;/p&gt; &lt;p&gt;That said, there's no crime in referencing an assembly on the client side  that's also used by the service to access the .NET type definitions of the  service contract and data contracts. You just have to make sure that your  service is usable by clients if they don't have access to the shared assembly,  rather than having to regenerate those types on the client side from the  metadata. To do so, just define these in a separate assembly from the service  implementation so that you can reference them from both sides without  introducing additional coupling. If you do this, keep in mind that you're  introducing a little more coupling between service and client in the interest of  productivity and speed of development and maintenance. &lt;/p&gt; &lt;p&gt;As mentioned in the earlier section on faults, an unhandled exception  delivered as a fault will also fault the communications channel with most of the  built-in bindings. When the fault is received in a WCF client, it's raised as a  FaultException if it wasn't specifically thrown as a FaultException&lt;t&gt; on  the service side. Because it's not consistent across all bindings, and because  your service code and client code should be decoupled from whatever particular  binding you use, the only safe thing to do on the client side if a service call  throws an exception is to assume the worst and avoid re-using the proxy. In  fact, even disposing of or closing the proxy can result in a subsequent  exception. This means you should wrap calls to a service in try/catch blocks and  replace the proxy instance with a new one in the catch block: &lt;/t&gt;&lt;/p&gt;&lt;pre class="codesnippet"&gt;public class MyClient&lt;br /&gt;{&lt;br /&gt; ProductServiceClient m_Proxy =&lt;br /&gt;    new ProductServiceClient();&lt;br /&gt;&lt;br /&gt; private void OnGetProducts(&lt;br /&gt;    object sender, RoutedEventArgs e)&lt;br /&gt; {&lt;br /&gt;    try&lt;br /&gt;    {&lt;br /&gt;       DataContext = m_Proxy.GetProducts();&lt;br /&gt;    }&lt;br /&gt;    catch (Exception ex)&lt;br /&gt;    {&lt;br /&gt;       m_Proxy = new ProductServiceClient();&lt;br /&gt;    }&lt;br /&gt; }&lt;br /&gt;}&lt;/pre&gt; &lt;p&gt;That's about it for taking advantage of WCF in the real world. I've covered a  lot of ground, including many of the constructs you will need to define WCF  services and clients. I've also discussed how best practices and real-world  considerations affect the choices you make for those constructs. Of course, this  is just a start; the real way to absorb these lessons is to sit down at a  keyboard and give them a go. To that end, the &lt;a href="http://code.visualstudiomagazine.com/vs0802bn.zip"&gt;sample code for this  article&lt;/a&gt; includes a full implementation of a service and client that calls  that service with all the basic code constructs. Feel free to give the code a  whirl and experiment with it to get a better feel for how the technologies in  this article fit together. &lt;/p&gt;&lt;/span&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-3983899672025929381?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/3983899672025929381/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=3983899672025929381' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/3983899672025929381'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/3983899672025929381'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2008/03/connect-apps-with-wcf.html' title='Connect Apps with WCF'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-6117924457496366466</id><published>2008-03-13T02:35:00.000-07:00</published><updated>2008-03-18T00:23:27.904-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio 2008'/><title type='text'>VSLive! San Francisco Preview: LINQ to SQL Q&amp;A with Perry Birch</title><content type='html'>&lt;span id="intelliTXT"&gt;There's a lot that LINQ to SQL (formerly called Dlinq) can offer developers, and in this Q&amp;amp;A preview of his &lt;a set="yes" linkindex="97" href="http://vslive.com/2008/sf/aspnet.aspx#va58" target="_blank"&gt;session&lt;/a&gt;, Birch outlines what's new, shares some of his favorite LINQ to SQL features and more.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span id="intelliTXT"&gt;&lt;b&gt;&lt;i&gt;What do you think are the top benefits for using LINQ to SQL?&lt;/i&gt;&lt;/b&gt; &lt;p&gt;&lt;b&gt;BIRCH:&lt;/b&gt; There are two primary benefits that I enjoy when using LINQ to SQL, the first one being the ease of transition for people moving from standard T-SQL query syntax to this new method of data retrieval. Both LINQ to SQL and T-SQL have very similar syntax and command results. It is also easy to create the mapping files that are used. &lt;/p&gt; &lt;p&gt;The second benefit is that LINQ to SQL derives from LINQ, which means that the techniques and syntax used to query for data becomes very similar in nature to querying for objects, XML and any other LINQ-enabled data source.&lt;/p&gt; &lt;p&gt;&lt;b&gt;&lt;i&gt;What's your favorite LINQ to SQL feature/tool?&lt;/i&gt;&lt;/b&gt;&lt;/p&gt; &lt;p&gt;&lt;b&gt;B:&lt;/b&gt; It really depends on the type of project I'm working on. For small and prototype projects, I really love the domain-specific language designer and code generation found in SQL Metal, simply because it is a pretty trick. However, when I'm looking at building a bigger, tiered application, I tend to shy away from all the attribute markup that is engrained into the class definitions; then, my second favorite feature (and the real reason to use LINQ to SQL) is the T-SQL generation. For anyone who is a db mapping enthusiast like me and hasn't yet looked into these, I highly recommend digging into the Binary Execution Trees which "LINQ to N" engines use to map to the various data stores.&lt;/p&gt; &lt;p&gt;&lt;b&gt;&lt;i&gt;When you first started using LINQ to SQL, was there anything that surprised you? &lt;/i&gt;&lt;/b&gt;&lt;/p&gt; &lt;p&gt;&lt;b&gt;B:&lt;/b&gt; I would say the biggest "hmm..." moments for me were related to disconnecting and reconnecting objects to the Data Context. I typically try to wrap the data calls into one or more interface contract(s) and pipe the data to the caller using serialized data via services. The problem is in the deserialization and reconnection of the object to the Data Context for create and update operations. I'll be using one workaround in my presentation at VSLive! 2008 at the end of March so I don't want to give too much away...Seriously, though, there are a few valid approaches to getting around this issue depending on your requirements/code style that are pretty easy to find if you search for them.&lt;/p&gt; &lt;p&gt;&lt;b&gt;&lt;i&gt;For users of LINQ to SQL's predecessor ObjectSpaces, what are the biggest differences that they should be aware of?&lt;/i&gt;&lt;/b&gt;&lt;/p&gt; &lt;p&gt;&lt;b&gt;B:&lt;/b&gt; The best way to clarify the differences between Object Spaces and LINQ to SQL is by showing the code. For example, to add a given object to an object spaces mapper you would use syntax like the following:&lt;/p&gt;  &lt;pre&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;public void addAnimal(int ID, string Species, string Age, string Weight)&lt;br /&gt;{&lt;br /&gt;  Animal animal = null;&lt;br /&gt;  IObjectSpace objectSpace;&lt;br /&gt;  objectSpace = ObjectSpaceFactory.CreateObjectSpace(mapFile);&lt;br /&gt;  animal = (Animal) objectSpace.CreateObject(typeof(Animal), ID, Age,&lt;br /&gt;Weight);&lt;br /&gt;  objectSpace.Update(animal);&lt;br /&gt;}&lt;/span&gt; &lt;/pre&gt; &lt;p&gt;There are a couple key elements to point out with this syntax. First, notice that the result type is not explicitly cast and requires a (Animal) boxing operation and a typeof(Animal) to specify the expected return type. Second, notice the list of parameters being passed into the create call. &lt;/p&gt;&lt;p&gt;An example of similar functionality using LINQ to SQL looks something like this:  &lt;/p&gt;&lt;pre&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;// This is now just a helper method&lt;br /&gt;public void addAnimal(string Species, string Age, string Weight)&lt;br /&gt;{&lt;br /&gt;  Animal animal = new Animal();&lt;br /&gt;  animal.Species = Species;&lt;br /&gt;  animal.Age = Age;&lt;br /&gt;  animal.Weight = Weight;&lt;br /&gt;   // Call to the actual add method&lt;br /&gt;  addAnimal(animal);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void addAnimal(Animal animal)&lt;br /&gt;{&lt;br /&gt;  ZooDataContext dc = new ZooDataContext();&lt;br /&gt;  dc.Animals.Add(animal);&lt;br /&gt;  dc.SubmitChanges();&lt;br /&gt;}&lt;/span&gt; &lt;/pre&gt; &lt;p&gt;It looks like more code but the rest of the app would be using the Animal POCO (plain ol' CLR objects), so most calls would now be using objects and one could simply use the new object instantiation method to create the object and forego the helper method entirely:&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;font-size:85%;"&gt;Animal animal = new Animal { Species = "Feline", Age = 5, Weight = 100 };&lt;br /&gt; addAnimal(animal);&lt;/span&gt;&lt;/p&gt; &lt;p&gt;Another and even more critical distinction comes when querying for objects. In ObjectSpaces the query filter has to be provided to the engine. This requires strict convention adherence and/or domain knowledge in order to create the queries. You may see something akin to the following:&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;font-size:85%;"&gt;string findFilter = "ID="+ID;&lt;br /&gt;animal = (Animal)objectSpace.GetObject(typeof(Animal), findFilter);&lt;/span&gt;&lt;/p&gt; &lt;p&gt;The developer writing this code has to know that the key field in the DB is named ID and any, more complicated filters require even more pre-knowlege of the database schema. In LINQ you would be using intellisense and type safe criteria to specify the filter:&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;font-size:85%;"&gt;var animal = dc.Animals.Single(a =&gt; a.ID == ID).SingleOrDefault();&lt;/span&gt;&lt;/p&gt; &lt;p&gt;Coming from a heavy SQL background and having created many cross-domain filtering methods, I really appreciate the flexibility, safety and simplicity of the new syntax.&lt;/p&gt; &lt;p&gt;&lt;b&gt;&lt;i&gt;Do you have a favorite LINQ to SQL tip you could share with our readers?&lt;/i&gt;&lt;/b&gt;&lt;/p&gt; &lt;p&gt;&lt;b&gt;B: &lt;/b&gt;The only thing I can really say is to jump in and start playing with this stuff. If you want a quick "up to speed" kind of experience, a good friend of mine, Daniel Egan, recently recorded a presentation where he goes into some pretty good depth on all the stuff behind LINQ to SQL and even shows some good intro code off. The link to that presentation can be found &lt;a set="yes" linkindex="98" href="http://live.ineta.org/Videos/" target="_blank"&gt;here&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;&lt;b&gt;&lt;i&gt;What, if any, downsides do you feel LINQ to SQL has?&lt;/i&gt;&lt;/b&gt;&lt;/p&gt; &lt;p&gt;&lt;b&gt;B:&lt;/b&gt; Right now, the two biggest downsides to LINQ to SQL is the lack of support for complex type mapping which, in most cases, precludes it from being very useful for legacy databases. Also, the current implementation of LINQ to SQL is, as the name implies, limited to mapping to a SQL Server Database, which means that all of the Oracle guys out there are missing out. The upside is that the LINQ semantics allow the creation of LINQ to Oracle.&lt;/p&gt; &lt;p&gt;&lt;b&gt;&lt;i&gt;Besides LINQ to SQL, what else in LINQ would you encourage developers to learn more about right away?&lt;/i&gt;&lt;/b&gt;&lt;/p&gt; &lt;p&gt;&lt;b&gt;B:&lt;/b&gt; The first step is to jump in and start playing with the new language features. Besides saving a lot of typing, when used properly, they can help you to more clearly express your code's intent. &lt;/p&gt; &lt;p&gt;If you haven't done so already, start using more delegates and play around with the anonymous methods. Once you have those two concepts down, you can start refactoring your code down to lambda expressions, then things start getting really exciting (and confusing for awhile; don't get intimidated).&lt;/p&gt; &lt;p&gt;A habit I picked up when writing lambdas is thinking to myself as I write out the expression.  For example:&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;font-size:85%;"&gt;var myList = new List&lt;complexobject&gt;(); &lt;-- anonymous type!&lt;/span&gt;&lt;/p&gt; &lt;p&gt;... Populate the list with a bunch of values ...&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:Arial, Helvetica, sans-serif;font-size:85%;"&gt;var average = myList.Average(c =&gt; c.IntegerProperty);&lt;/span&gt;&lt;/p&gt; &lt;p&gt;While writing the "c =&gt; c.IntegerProperty" I'm thinking something along the lines of:&lt;/p&gt; &lt;p&gt;"c is a ComplexObject and I want the IntegerProperty"&lt;/p&gt; &lt;p&gt;or&lt;/p&gt; &lt;p&gt;"c such that I get the average of all ComplexType's IntegerProperty"&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-6117924457496366466?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/6117924457496366466/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=6117924457496366466' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/6117924457496366466'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/6117924457496366466'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2008/03/vslive-san-francisco-preview-linq-to.html' title='VSLive! San Francisco Preview: LINQ to SQL Q&amp;A with Perry Birch'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-7427304886582643126</id><published>2008-03-12T04:44:00.000-07:00</published><updated>2008-03-18T00:20:09.142-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio 2008'/><title type='text'>C#'s Query Syntax for LINQ</title><content type='html'>&lt;p class="articledeck"&gt; Take advantage of the new keywords associated with C# 3.0's query syntax. Learn how these keywords map to methods defined using the query operands, and how you can define your own custom implementation for the query keywords. &lt;/p&gt;          &lt;p class="articlebyline"&gt;&lt;br /&gt;&lt;/p&gt;C# 3.0 includes many strong new features, but one of the most interesting is the inclusion of its new query keywords, that you use to create Query Expressions. Query Expressions are most commonly associated with Language Integrated Query (LINQ). They're the core syntax that you'll use when you create LINQ queries, whether you use LINQ to Objects, LINQ to SQL, LINQ to XML, or some other custom LINQ provider. I'll discuss the query keywords, how those keywords map to methods defined using the query operands, and how you can define your own custom implementation for the query keywords. &lt;span id="intelliTXT"&gt; &lt;div align="center"&gt;&lt;noscript&gt;&lt;br /&gt;&lt;/noscript&gt;  &lt;/div&gt;&lt;br /&gt;One of the design goals of the C# language (and most computer programming languages) is to keep the set of keywords small. Fewer keywords means there's more vocabulary available for your types, members, and other user-defined identifiers. It also simplifies the job of understanding the language. The C# team worked to minimize the necessary grammar for LINQ and the associated query syntax. They ended up adding eight contextual keywords to the C# language specifically for query: from, where, select, group, into, orderby, join, and let. &lt;p&gt;The C# team also saw type inference as a major goal of the new release. The C# language is still strongly typed: every identifier has a known type, at least to the compiler. However, a developer must declare the type explicitly only when the compiler cannot make its own determination of the variable's type. In many cases, the compiler determines the proper type for you. &lt;/p&gt;&lt;p&gt;Every query expression begins with the "from" keyword. From introduces a query expression by declaring the datasource and range variable. This snippet defines a simple query: &lt;/p&gt;&lt;pre class="codesnippet"&gt;int[] someNumbers = { 2, 3, 7, 11, 13, 17, 19 };&lt;br /&gt;var query = from number in someNumbers &lt;/pre&gt;  &lt;p&gt;someNumbers is the datasource, and number is the range variable. The datasource must implement IEnumerable&lt;t&gt;, or IEnumerable. In this example, someNumbers implements IEnumerable&lt;int&gt;. The compiler gives the range variable a type to match the type enumerated by the datasource. In the example above, number will be an integer. In general, the range variable is of type T, whenever the datasource implements IEnumerable&lt;t&gt;. In the case where the range variable implements IEnumerable, the range variable is a System.Object. You never need to declare the type of the range variable; the compiler infers it. &lt;/t&gt;&lt;/int&gt;&lt;/t&gt;&lt;/p&gt; &lt;p&gt;&lt;b&gt;Do More with "From"&lt;/b&gt;&lt;br /&gt;The "from" clause can do much more than iterate a single sequence. Often, an outer sequence will contain an inner sequence that contains the data you're interested in. You can nest from clauses to create the sequence of elements from the inner sequences . Using multiple from clauses when the second datasource isn't a member of the first range variable will do a cross-join. This simple expression produces 25 pairs of values, ranging from {1,2} through {9,2} on to {1,10}, and, finally, through {9,10}: &lt;/p&gt; &lt;pre class="codesnippet"&gt;int[] evenNumbers = { 2, 4, 6, 8, 10 };&lt;br /&gt;int[] odddNumbers = { 1, 3, 5, 7, 9 };&lt;br /&gt;&lt;br /&gt;var pairs = from even in evenNumbers&lt;br /&gt; from odd in odddNumbers&lt;br /&gt; select new { even, odd };&lt;br /&gt;&lt;br /&gt;foreach (var pair in pairs)&lt;br /&gt; Console.WriteLine(&lt;br /&gt;    " odd = {0}, even = {1}",&lt;br /&gt;    pair.odd, pair.even);&lt;/pre&gt;  &lt;p&gt;This from clause generates every permutation of a value from the first sequence value, and then pairs it with a value from the second sequence. Of course, you're not limited to two sources. You could do an N-way cross-join for any number N. Just remember that the size of the result set will grow geometrically as you add more source sequences. &lt;/p&gt;&lt;p&gt;The next new keyword is select. Select determines what type of object or objects are returned by your query. Select is powerful enough to create whatever types you want, including anonymous types, as the output of a query. Select projects the values you want into the output of a query. You've already seen two examples of the select statement. Listing 1 showed a simple select that returns the same type as the input query. The immediately preceding code snippet illustrating the cross-join shows an example of a select that transforms the input type into another type. In that case, it creates a new type containing a number from the first sequence and a number from the second sequence. The compiler does quite a bit of work for you in that example. The compiler infers the shape of the items in the output sequence, and it creates an anonymous type matching that description. The output sequence contains values of that anonymous type. It sounds more difficult than it really is. In that example, the compiler creates a type that contains two integers: odd and even. Those integers are accessed through public read-only properties. The compiler writes a type similar to the type you would have created by hand. &lt;/p&gt;&lt;p&gt;In general, you can use the select keyword to transform the values in the query into any type you decide you want for the output from the query. You'll see this feature at work in several of this article's examples. For instance, you'll see that you can compute values as part of the output, combine multiple inputs into a single output stream, generate new types, or almost anything else. Select is quite powerful because its argument is an arbitrary lambda expression that can return anything computed from the input sequence. &lt;/p&gt; &lt;p&gt;&lt;b&gt;Filter the Input Sequence&lt;/b&gt;&lt;br /&gt;Another keyword you'll use frequently is where. Where filters the input sequence and passes only those values that match the condition specified by the where predicate. You can place where clauses almost anywhere in your query expression. The only restrictions are that it must not be first, nor can it be last. For example, assume you want to filter the input sequence so it returns only those values greater than five: &lt;/p&gt; &lt;pre class="codesnippet"&gt;var query = from number in someNumbers&lt;br /&gt; where number &gt; 5&lt;br /&gt; select number;&lt;/pre&gt;  &lt;p&gt;Where clauses can also be more complicated. For example, you can combine multiple conditions into a single where clause: &lt;/p&gt; &lt;pre class="codesnippet"&gt;var query = from number in someNumbers&lt;br /&gt; where number &gt; 5 &amp;amp;&amp;amp; number * number &lt;/pre&gt;  &lt;p&gt;An alternative approach is to express the same construct with multiple where clauses: &lt;/p&gt; &lt;pre class="codesnippet"&gt;var query = from number in someNumbers&lt;br /&gt; where number &gt; 5&lt;br /&gt; where number * number &lt;/pre&gt; &lt;p&gt;Where works the same way even when there are multiple sources, and you want to provide filters on those elements. All these query expressions produce the same result: &lt;/p&gt; &lt;pre class="codesnippet"&gt;var pairs1 = from even in evenNumbers&lt;br /&gt; where even &gt; 4&lt;br /&gt; from odd in odddNumbers&lt;br /&gt; where odd &lt; pairs2 =" from"&gt; 4&lt;br /&gt; where odd &lt; pairs2 =" from"&gt; 4 &amp;amp;&amp;amp; odd &lt;/pre&gt;  &lt;p&gt;In general, you should consider placing where clauses as early as possible in your queries. Later clauses in your query operate on a smaller set of data. &lt;/p&gt;&lt;p&gt;Another new query keyword is orderby. Orderby creates an ordering of the output sequence. You can order the output elements on any expression that's part of the input sequence, even if that element isn't part of the output sequence, or by an element that's computed from part of the input sequence. &lt;/p&gt;&lt;p&gt;This query sorts the list of names by the length of the name and then by alphabetical order: &lt;/p&gt; &lt;pre class="codesnippet"&gt;var folks = from person in myPeeps&lt;br /&gt; orderby person.Last.Length + person.First.Length&lt;br /&gt;    descending,&lt;br /&gt; person.Last,&lt;br /&gt; person.First&lt;br /&gt; select string.Format("{0}, {1}",&lt;br /&gt;    person.Last, person.First);&lt;/pre&gt;  &lt;p&gt;The first orderby arranges the sequence of elements from longest to shortest. In the case of ties, the last name will be used to order the people. If there are still any ties, the first name will be used. Note that I've also transformed the person object into a string in the select statement. &lt;/p&gt;&lt;p&gt;As I mentioned earlier, the select statement can create any output type you wish. In most cases, I like to put the orderby clauses as late in the query expression as possible. Orderby needs the full sequence to do its work, so it creates a natural bottleneck on the sequence processing. &lt;/p&gt; &lt;p&gt;&lt;b&gt;Subdivide the Results&lt;/b&gt;&lt;br /&gt;Occasionally, you'll use the group clause to subdivide the results of the query into logical groupings. You could modify the previous query by grouping the names by the length of the first name: &lt;/p&gt; &lt;pre class="codesnippet"&gt;var folks = from person in myPeeps&lt;br /&gt; group person by person.First.Length into names&lt;br /&gt;    orderby names.Key&lt;br /&gt;    select names;&lt;/pre&gt; &lt;p&gt;There are a number of new ideas here, so let's look at them closely. This group expression creates subdivisions based on the length of the first name of each person. It's common to want to perform further processing on each group. Therefore, you'll often see an "into" following the group clause. The into keyword assigns a name to each grouping. In the above example, that grouping is called "names." Next, you see the familiar orderby clause to order the groups based on the key assigned to each group. The Key is the value of the "by" portion of the group clause. In this example, the Key is an integer, which stores the length of the first names in the group. &lt;/p&gt;&lt;p&gt;The result sequence of the query uses a different type when you add the group clause. The results for a group clause are stored in an IEnumerable&lt;tkey,&gt;&gt; sequence. That's a sequence of groups. For each element, the Key element stores the key, and the IGrouping implements IEnumerable&lt;telement&gt; so that you can iterate the values in each group. &lt;/telement&gt;&lt;/tkey,&gt;&lt;/p&gt;&lt;p&gt;You use the join clause to perform equijoins. An equijoin creates a single sequence from two different input sequences based on an equality test of some property in both sequences. There are three different variations of join. Join is most easily illustrated in the context of LINQ to SQL, so these examples are taken from the Sample Queries sample application that ships with Visual Studio 2008. They perform joins on different tables in the Northwind database. &lt;/p&gt;&lt;p&gt;This query performs an inner join between the categories and products tables to produce a single sequence with the products and categories listed: &lt;/p&gt; &lt;pre class="codesnippet"&gt;var q =&lt;br /&gt; from c in db.Categories&lt;br /&gt; join p in db.Products on c.ID equals&lt;br /&gt;    p.CategoryID&lt;br /&gt; select new&lt;br /&gt;    {productName = p.ProductName,&lt;br /&gt;    categoryName = c.Name};&lt;/pre&gt;  &lt;p&gt;This code snippet creates a single sequence that contains the product name and category name. If a category doesn't have any matching products, that category doesn't appear in the output. &lt;/p&gt;&lt;p&gt;If you use the into keyword with your join clause, you create a group join. Similar to the groupby clause, a group join creates a list of lists for each group. In that same vein, you could create a list of all categories where each element contains the list of all products in that category: &lt;/p&gt; &lt;pre class="codesnippet"&gt;var q =&lt;br /&gt; from c in db.Categories&lt;br /&gt; join p in db.Products on c.ID equals&lt;br /&gt;    p.CategoryID into productGroup&lt;br /&gt; select new&lt;br /&gt;    {categoryName  = c.Name,&lt;br /&gt;    Products =productGroup};&lt;/pre&gt;  &lt;p&gt;The only noticeable difference is the addition of the into keyword to create a set of groups. However, when you use the group join, any of the elements on the left side source won't appear in the output sequence unless there are matching elements in the right input sequence. In the preceding example, that means any categories with no products won't appear in the output sequence. To fix that, you need the left outer join. That requires using the DefaultIfEmpty method. This variation returns all categories, even those with no products: &lt;/p&gt; &lt;pre class="codesnippet"&gt;var q =&lt;br /&gt; from c in db.Categories&lt;br /&gt; join p in db.Products on c.ID equals&lt;br /&gt;    p.CategoryID into productGroup&lt;br /&gt; from aproduct in     &lt;br /&gt;    productGroup.DefaultIfEmpty()&lt;br /&gt; select new&lt;br /&gt;    {categoryName  = c.Name,&lt;br /&gt;    Product =aproduct};&lt;/pre&gt;  &lt;p&gt;The left outer join produces a single, flat sequence, like the inner join. The element will contain the category and the product. In the approach used here, the product will be null if there are no products associated with a given category. &lt;/p&gt;&lt;p&gt;Only one keyword remains--let. Let creates a new range variable in the query expression. You can use this for a couple different purposes. First, if the new range variable is an enumerable type, it can be queried. Alternatively, it can store the result of some computation to avoid recomputing it. &lt;/p&gt;&lt;p&gt;Let's look at this keyword in action.  &lt;/p&gt;&lt;p&gt;Suppose you want to modify the pair of numbers sample to keep only those pairs of numbers where the distance from the origin is less than 10. You could modify the query this way: &lt;/p&gt; &lt;pre class="codesnippet"&gt;var pairs = from even in evenNumbers&lt;br /&gt; from odd in odddNumbers&lt;br /&gt; where Math.Sqrt(&lt;br /&gt;    even * even + odd * odd) &lt;/pre&gt;  &lt;p&gt;That's fine, but now assume you also want to include the distance from the origin in the output sequence. You could write it this way, but you'd be computing the distance twice for every value: &lt;/p&gt; &lt;pre class="codesnippet"&gt;var pairs = from even in evenNumbers&lt;br /&gt; from odd in odddNumbers&lt;br /&gt; where Math.Sqrt(even * even + odd * odd) &lt; distance ="  Math.Sqrt(even"&gt; &lt;/pre&gt;  &lt;p&gt;This is a great place to use the let clause. You can rewrite the clause this way so that you have to compute the distance only once: &lt;/p&gt; &lt;pre class="codesnippet"&gt;var pairs = from even in evenNumbers&lt;br /&gt; from odd in odddNumbers&lt;br /&gt; let distance = Math.Sqrt(even * even + odd * odd)&lt;br /&gt; where distance &lt;/pre&gt;  &lt;p&gt;The second use of let is less common. If your interim calculation produces a sequence, you could use that range variable in a from clause and process each element in the sequence. &lt;/p&gt; &lt;p&gt;&lt;b&gt;Map Keywords to Methods&lt;/b&gt;&lt;br /&gt;That's all the new queries that support query expressions. Most of these new keywords compile to method calls. Where compiles to a call to the Where() method. Select compiles to a call to the Select() method. The first orderby compiles to a call to the OrderBy() method. Subsequent calls compile to ThenBy(). If the orderby clauses include the descending keyword, the methods called are OrderByDescending() and ThenByDescending(). Group clauses translate into the GroupBy() method calls. Join usually compiles to a call to Join(); if it's followed by "into," it compiles to a GroupJoin() method. &lt;/p&gt;&lt;p&gt;The .NET 3.5 base class library contains versions of each of these methods in two different classes: System.Linq.Queryable and System.Linq.Enumerable. The versions in Enumerable are defined so that the standard query operators can be used in any sequence. The Queryable version is used when the source supports IQueryable. &lt;/p&gt;&lt;p&gt;This might not sound so important, but there's a good reason for you to understand that these keywords map to specific methods: They're methods, so you can define your own version for your own types if you can create a better version than the default. The default versions are defined as extension methods, which means that any version you write will probably be a better match. &lt;/p&gt;&lt;p&gt;The standard query operators are general methods. Each of them takes expression trees, so you're signing up for quite a bit of work when you define your own versions of these. You'll more likely define your own versions of other extension methods defined in Queryable or Enumerable. Obvious examples are Take and Skip. You might use Skip to implement any container implementing IList&lt;t&gt;: &lt;/t&gt;&lt;/p&gt; &lt;pre class="codesnippet"&gt;public static IEnumerable&lt;t&gt;&lt;br /&gt; Skip&lt;t&gt;(IList&lt;t&gt; sequence,&lt;br /&gt; int count)&lt;br /&gt;{&lt;br /&gt; for (int i = count;&lt;br /&gt; i &lt;&gt;&lt;/t&gt;&lt;/t&gt;&lt;/pre&gt;  &lt;p&gt;Note that you can avoid any number of MoveNext calls by using the indexing operator. &lt;/p&gt;&lt;p&gt;Similarly, you could add your own versions of any of the methods defined in System.Linq.Enumerable, where you had a more efficient way of computing the answer. &lt;/p&gt;&lt;p&gt;Earlier in this article, I mentioned that these new keywords are contextual keywords. That's important for backward compatibility with existing programs. These new keywords are only reserved words when they appear in the proper location. These variable declarations are all legal C# 3.0: &lt;/p&gt; &lt;pre class="codesnippet"&gt;int where = 5;&lt;br /&gt;string select = "This is a string";&lt;br /&gt;int var = 7;&lt;/pre&gt;  &lt;p&gt;That's because the keywords where, select, and var aren't appearing in the proper context for the compiler to view them in their special new way. &lt;/p&gt;&lt;p&gt;This might also seem like language geek trivia, but it's important for most developers. The C# team worked hard to ensure that these new additional features wouldn't break existing programs. By making these new keywords contextual keywords, they were able to introduce new syntax, while minimizing the chance of breaking any existing C# code. None of this new syntax will break your existing code. &lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-7427304886582643126?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/7427304886582643126/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=7427304886582643126' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/7427304886582643126'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/7427304886582643126'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2008/03/cs-query-syntax-for-linq.html' title='C#&apos;s Query Syntax for LINQ'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-5883785037925165142</id><published>2008-03-10T23:19:00.001-07:00</published><updated>2008-03-18T00:23:14.190-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio 2008'/><title type='text'>How to view code that is covered by the IntelliSense pop-up</title><content type='html'>When working in Visual Studio 2008 and the IntelliSense pop-up is visible, but you would like to view the code that is covered by it, press and hold the &lt;strong&gt;Ctrl&lt;/strong&gt; key, and the pop-up becomes transparent so that you can view the code that is below the pop-up. &lt;p&gt;&lt;img src="http://dotnettipoftheday.org/resources/intellisense-opacity.png" alt="" /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-5883785037925165142?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/5883785037925165142/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=5883785037925165142' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/5883785037925165142'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/5883785037925165142'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2008/03/how-to-view-code-that-is-covered-by.html' title='How to view code that is covered by the IntelliSense pop-up'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-2431499312999922165</id><published>2008-03-10T04:38:00.000-07:00</published><updated>2008-03-18T00:22:54.858-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio 2008'/><title type='text'>Inside Functional Programming</title><content type='html'>&lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=""&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;Inside Functional Programming&lt;/span&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=""&gt;Take advantage of functional programming techniques like Filter, Map, and Reduce in your day-to-day business apps. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;i&gt;&lt;span style=""&gt;TECHNOLOGY TOOLBOX: C#, SQL Server 2005 Compact Edition Runtime, Visual Studio 2005 Standard Edition SP1 or Higher, SQL Server Management Studio [Express] SP2 &lt;/span&gt;&lt;/i&gt;&lt;span style=""&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=""&gt;As you start using C# 3.0, you'll find yourself diving deeper into the concepts created for functional programming. This is the academic research done for languages like LISP, ML, Haskell, and others that have only a small installed base in professional programming environments. In a way, that's too bad, because many of these concepts provide elegant solutions to many of the &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=""&gt;&lt;br /&gt;The incorporation of these functional programming techniques into .NET is one of the reasons why I'm excited about the release of C# 3.0 and Visual Studio (VS) 2008. You can use these same concepts in your favorite language. That's important for a couple of reasons. First, you're more familiar with the syntax of your preferred language and that makes it much easier to continue being productive. Second, you can mix these functional programming concepts alongside more traditional imperative algorithms. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=""&gt;Of course, you also give something up by staying in your familiar environment. Doing things the way you're accustomed to doing them often means that you're slow to try and adapt new techniques. Other times, you might not get the full advantage of a given technique because you're using it in your familiar context, and that context doesn't take full advantage of the technique. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=""&gt;This article will familiarize you with three of the most common functional programming elements: the higher order functions Filter, Map, and Reduce. You're probably already familiar with the general concepts--if not the specific terms--so much of the research associated with functional programming will be fairly accessible. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;b&gt;&lt;span style=""&gt;Define a Value's Removal&lt;/span&gt;&lt;/b&gt;&lt;span style=""&gt;&lt;br /&gt;You've already used the concept of Filter, even in C# 2.0. List&lt;t&gt; contains a RemoveAll() method. RemoveAll takes a delegate and that delegate determines which values should be removed from your collection. For example, this code removes all integers from the someNumbers collections that are divisible by 3: &lt;o:p&gt;&lt;/o:p&gt;&lt;/t&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=""&gt;­&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;span id="intelliTXT"&gt;&lt;pre class="codesnippet"&gt;List&lt;int&gt; someNumbers = new List&lt;int&gt;&lt;br /&gt;  { 1, 2, 3, 4, 5, 6, 7, 8, 9,&lt;br /&gt;     10, 11, 12, 13, 14, 15 };&lt;br /&gt;&lt;br /&gt;someNumbers.RemoveAll(&lt;br /&gt;  delegate(int num)&lt;br /&gt;     { return num % 3 == 0; });&lt;/pre&gt;&lt;/span&gt;&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=""&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=""&gt;C# 3.0 provides a more concise way to express that same concept: &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=""&gt;someNumbers.RemoveAll(num =&gt; num % 3 == 0);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=""&gt;That's a filter. The filter defines when to remove a value. Let's take a small detour into vocabulary land. A Higher-Order function is simply a function that takes a function as a parameter, or returns a function, or both. Both of these samples fit that description. In both cases, the parameter to RemoveAll() is the function that describes what members should be removed from the set. Internally, the RemoveAll() method calls your function once on every item in the sequence. When there's a match, that item gets removed. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=""&gt;In C# 3.0 and Language Integrated Query (LINQ) syntax, the Where clause defines the filter. In the case of Where, the filter expression might not be evaluated as a delegate. LINQ to SQL processes the expression tree representation of your query. By examining the expression tree, LINQ to SQL can create a T-SQL representation of your query and execute the query using the database engine, rather than invoking the delegate. Any provider that implements IQueryable&lt;t&gt; or IQueryable will parse the expression tree and translate it into the best format for the provider. &lt;o:p&gt;&lt;/o:p&gt;&lt;/t&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=""&gt;A filter is the simplest form of a higher order function. Its input is a sequence, and its output is a proper subset of the input sequence. The concept is already familiar to you, and it shows the fundamental concept of passing a function as a parameter to another function. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=""&gt;C# 2.0 and the corresponding methods in the .NET framework did not fully embrace the concepts of functional programming. You can see that in the way RemoveAll is implemented. It's a member of the List&lt;t&gt; class, and it modifies that object. A true Filter takes its input sequence as a parameter and returns the output sequence; it doesn't modify the state of its input sequence. &lt;o:p&gt;&lt;/o:p&gt;&lt;/t&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;b&gt;&lt;span style=""&gt;Return a New Sequence&lt;/span&gt;&lt;/b&gt;&lt;span style=""&gt;&lt;br /&gt;Map is the second major building block you'll see in functional programming. Map returns a new sequence computed from an input sequence. Similar to Filter, Map takes a function as one of its parameters. That function transforms a single input element into the corresponding output element. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=""&gt;As with Filter, there's similar functionality in the .NET base library. List&lt;t&gt;.ConvertAll produces a new list of elements using a delegate you define that transforms a single input element into the corresponding output element. Here, the conversion computes the square of every number: &lt;o:p&gt;&lt;/o:p&gt;&lt;/t&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span id="intelliTXT"&gt;&lt;pre class="codesnippet"&gt;List&lt;int&gt; someNumbers = new List&lt;int&gt;&lt;br /&gt;  { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };&lt;br /&gt;List&lt;int&gt; squares = someNumbers.ConvertAll(&lt;br /&gt;  delegate(int num)&lt;br /&gt;{&lt;br /&gt;  return num * num;&lt;br /&gt;});&lt;br /&gt;squares.ForEach(delegate(int num)&lt;br /&gt;  { Console.WriteLine(num); });&lt;/pre&gt;  &lt;p&gt;In C# 3.0, lambda syntax makes this more concise: &lt;/p&gt; &lt;pre class="codesnippet"&gt;List&lt;int&gt; squares =&lt;br /&gt;  someNumbers.ConvertAll(num =&gt; num * num);&lt;/pre&gt;  &lt;p&gt;Filter is built in to the query syntax added in C# 3.0: &lt;/p&gt; &lt;pre class="codesnippet"&gt;IEnumerable&lt;int&gt; squares = from num in someNumbers&lt;br /&gt;  select num * num;&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=""&gt;Of course, you probably noticed that quick change in the last code snippet. The last version returned an IEnumerable&lt;int&gt; rather than a List&lt;int&gt;. The C# 3.0 versions of these methods operate on sequences, and aren't members of any particular type. &lt;o:p&gt;&lt;/o:p&gt;&lt;/int&gt;&lt;/int&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=""&gt;There's nothing that says the output sequence has to be of the same type as the input sequence. This method returns a list of formatted strings computed from a set of input numbers: &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;span id="intelliTXT"&gt;&lt;pre class="codesnippet"&gt;List&lt;int&gt; someNumbers =&lt;br /&gt;  new List&lt;int&gt;&lt;br /&gt;  { 1, 2, 3, 4, 5, 6, 7, 8,&lt;br /&gt;     9, 10, 11, 12, 13, 14, 15 };&lt;br /&gt;List&lt;string&gt; formattedNumbers =&lt;br /&gt;  someNumbers.ConvertAll(&lt;br /&gt;  delegate(int num)&lt;br /&gt;{&lt;br /&gt;  return string.Format("{0:D6}", num);&lt;br /&gt;});&lt;br /&gt;formattedNumbers.ForEach(&lt;br /&gt;  delegate(string num)&lt;br /&gt;  { Console.WriteLine(num); });&lt;/pre&gt;  &lt;p&gt;Of course, the same method gets simplified using C# 3.0: &lt;/p&gt; &lt;pre class="codesnippet"&gt;List&lt;string&gt; formattedNumbers =&lt;br /&gt;  someNumbers.ConvertAll&lt;br /&gt;  (num =&gt; string.Format("{0:D6}", num));&lt;br /&gt;And can be further simplified using the query syntax:&lt;br /&gt;&lt;br /&gt;IEnumerable&lt;string&gt; formattedNumbers =&lt;br /&gt;  from num in someNumbers&lt;br /&gt;  select string.Format("{0:D6}", num);&lt;/pre&gt;&lt;/span&gt;&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=""&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=""&gt;As with Filter, you've used functionality like Map before. You might not have known what it was called, or where its computer science roots lie. Filter is nothing more than a convention where you write a method that converts one sequence type into another, and the specifics of that conversion are coded into a second method. That second method is then passed on as a parameter to the Map function. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;b&gt;&lt;span style=""&gt;One Function to Rule Them All: Reduce&lt;/span&gt;&lt;/b&gt;&lt;span style=""&gt;&lt;br /&gt;The most powerful of the three concepts I'm covering this month is Reduce. (You'll also find some references that use the term "Fold.") Reduce returns a single scalar value that's computed by visiting all the members of a sequence. Reduce is one of those concepts that is much simpler once you see some examples. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=""&gt;This simple code snippet computes the sum of all values in the sequence: &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;span id="intelliTXT"&gt;&lt;pre class="codesnippet"&gt;List&lt;int&gt; someNumbers = new List&lt;int&gt;&lt;br /&gt;  { 1, 2, 3, 4, 5, 6, 7, 8, 9,&lt;br /&gt;     10, 11, 12, 13, 14, 15 };&lt;br /&gt;int sum = 0;&lt;br /&gt;foreach (int num in someNumbers)&lt;br /&gt;  sum += num;&lt;br /&gt;Console.WriteLine(sum);&lt;/pre&gt;&lt;/span&gt;&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=""&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=""&gt;This is simple stuff that you've written many times. The problem is that you can't reuse any of it anywhere. Also, many other examples will likely contain more complicated code inside the loop. So smart computer science wizards decided to take on this problem and create a way to pass along that inner code as a parameter to a generic method. In C# 3.0, the answer is the Aggregate extension method. Aggregate has a few overloads. This example uses the simplest form: &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;span id="intelliTXT"&gt;&lt;pre class="codesnippet"&gt;List&lt;int&gt; someNumbers = new List&lt;int&gt;&lt;br /&gt;  { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,&lt;br /&gt;     11, 12, 13, 14, 15 };&lt;br /&gt;int sum = someNumbers.Aggregate(&lt;br /&gt;  delegate(int currentSum, int num)&lt;br /&gt;{&lt;br /&gt;  return currentSum + num;&lt;br /&gt;});&lt;br /&gt;Console.WriteLine(sum);&lt;/pre&gt;&lt;/span&gt;&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=""&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=""&gt;The delegate continues to produce a running sum from the current value in the sequence, as well as the total accumulated so far. There are two other overloads of Aggregate. One takes a seed value: &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;span id="intelliTXT"&gt;&lt;pre class="codesnippet"&gt;int sum = someNumbers.Aggregate(0,&lt;br /&gt;delegate(int currentSum, int num)&lt;br /&gt;{&lt;br /&gt;   return currentSum + num;&lt;br /&gt;});&lt;/pre&gt;&lt;/span&gt;&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=""&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=""&gt;The final overload allows you to specify a different return type. Suppose you wanted to build a comma-separated string of all the values. You'd use the third version of Aggregate: &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;span id="intelliTXT"&gt;&lt;pre class="codesnippet"&gt;List&lt;int&gt; someNumbers = new List&lt;int&gt;&lt;br /&gt;  { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,&lt;br /&gt;     11, 12, 13, 14, 15 };&lt;br /&gt;string formattedValues =&lt;br /&gt;  someNumbers.Aggregate(null,&lt;br /&gt;  delegate(string currentOutput, int num)&lt;br /&gt;{&lt;br /&gt;  if (currentOutput != null)&lt;br /&gt;     return string.Format("{0}, {1}",&lt;br /&gt;        currentOutput, num);&lt;br /&gt;  else&lt;br /&gt;     return num.ToString();&lt;br /&gt;});&lt;br /&gt;Console.WriteLine(formattedValues);&lt;/pre&gt;  &lt;p&gt;Of course, all of these can be rewritten using lambda syntax: &lt;/p&gt; &lt;pre class="codesnippet"&gt;int sum = someNumbers.Aggregate(&lt;br /&gt;  0, (currentSum, num) &lt;br /&gt;  =&gt; currentSum + num);&lt;br /&gt;// Or:&lt;br /&gt;string formattedValues = someNumbers.Aggregate("",&lt;br /&gt;  (currentOutput, num)&lt;br /&gt;  =&gt; (currentOutput != null) ?&lt;br /&gt;     string.Format("{0}, {1}", currentOutput, num) :&lt;br /&gt;     num.ToString()&lt;br /&gt;     );&lt;/pre&gt;&lt;/span&gt;&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=""&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=""&gt;The second example converts the numbers to a list of strings, and it's a bit more complicated code. But it's all stuff you've seen before. The second example uses only the ternary operator to do the test. If this makes you uncomfortable, you can use the imperative syntax with lambda expressions: &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;span id="intelliTXT"&gt;&lt;pre class="codesnippet"&gt;string formattedValues =&lt;br /&gt;  someNumbers.Aggregate(&lt;br /&gt;     "", (currentOutput, num)&lt;br /&gt;  =&gt;&lt;br /&gt;  {&lt;br /&gt;     if (currentOutput != null)&lt;br /&gt;        return string.Format("{0}, {1}",&lt;br /&gt;        currentOutput, num);&lt;br /&gt;     else&lt;br /&gt;        return num.ToString();&lt;br /&gt;  });&lt;/pre&gt;&lt;/span&gt;&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=""&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=""&gt;Earlier, I paraphrased Tolkien, and called Reduce the one function to rule them all. From a computer science perspective, Filter and Map are nothing more than special cases of Reduce. If you define a Reduce method where the return value type is a sequence, you can implement Map and Filter using Reduce. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=""&gt;However, most libraries don't work that way because Map and Filter can perform much better if they don't share code with Reduce. And the Filter and Map prototypes are quite a bit simpler to understand. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height: normal;"&gt;&lt;span style=""&gt;This column contained some low-level concepts that will help you understand the computer science upon which C# 3.0, LINQ, and much of the .NET 3.5 Framework were built. It's all stuff you've seen before, and it's not that difficult. It's just that they come with new twists and more concise code around what you've already been doing. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-2431499312999922165?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/2431499312999922165/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=2431499312999922165' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/2431499312999922165'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/2431499312999922165'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2008/03/inside-functional-programming.html' title='Inside Functional Programming'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-8178683937458956060</id><published>2006-11-27T22:47:00.000-08:00</published><updated>2008-03-18T00:22:29.581-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tech News'/><title type='text'>Google fixes security flaw in Reader</title><content type='html'>Google said it fixed a security flaw in Google Reader on Wednesday that could have allowed a hacker to steal sensitive information from Web surfers.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://news.com.com/Google+fixes+security+flaw+in+Google+Reader/2100-1002_3-6090974.html"&gt;Read More&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-8178683937458956060?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/8178683937458956060/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=8178683937458956060' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/8178683937458956060'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/8178683937458956060'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2006/11/google-fixes-security-flaw-in-reader.html' title='Google fixes security flaw in Reader'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-7090856633843586542</id><published>2006-11-23T04:44:00.000-08:00</published><updated>2008-03-18T00:21:14.560-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tech News'/><title type='text'>Google, Yahoo!, and Microsoft join forces on sitemaps</title><content type='html'>&lt;a href="http://blog.searchenginewatch.com/blog/061116-000001"&gt;&lt;/a&gt;That sound you hear? It's the sound of a million webmasters shouting for joy. I certainly didn't see it coming, but Microsoft, Yahoo!, and Google have entered an agreement to support a single, unified sitemap protocol, which webmasters can use to give all three companies' search engines a complete listing of their site's pages.&lt;br /&gt;Microsoft's &lt;a href="http://blogs.msdn.com/livesearch/archive/2006/11/15/microsoft-google-yahoo-unite-to-support-sitemaps.aspx"&gt;Live Search Blog&lt;/a&gt;, the &lt;a href="http://www.ysearchblog.com/archives/000380.html"&gt;Yahoo! Search Blog&lt;/a&gt;, and Google's &lt;a href="http://googlewebmastercentral.blogspot.com/2006/11/joint-support-for-sitemap-protocol.html"&gt;Webmaster Central Blog&lt;/a&gt; all have announcements about the unified effort, and the companies have launched &lt;a href="http://www.sitemaps.org/"&gt;sitemaps.org&lt;/a&gt; to promote the protocol. The protocol itself has been released under the Creative Commons license and other search engines have been invited to use it as well. Search Engine Watch &lt;a href="http://blog.searchenginewatch.com/blog/061116-000001"&gt;has the press release&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.sitemaps.org/"&gt;&lt;span style="color:#ff0000;"&gt;Read More&lt;/span&gt;&lt;/a&gt;&lt;span style="color:#ff0000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-7090856633843586542?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/7090856633843586542/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=7090856633843586542' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/7090856633843586542'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/7090856633843586542'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2006/11/google-yahoo-and-microsoft-join-forces.html' title='Google, Yahoo!, and Microsoft join forces on sitemaps'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1071632340652365387.post-1893111983696955533</id><published>2006-11-22T23:00:00.000-08:00</published><updated>2008-03-18T00:21:36.685-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tech News'/><title type='text'>Searchdotnet.com - Google Custom Search Engine For .NET</title><content type='html'>Appleman, president of Desaware has published Searchdotnet.com. Using the Google custom search engine technology, this site enables developers to easily search for .NET specific information over 400+ web sites. He has also created a specific search engine for .NET components http://searchdotnet.com/components/default.aspx. Developers are invited not only to utilize the sites but also to suggest web sites for inclusion.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://searchdotnet.com/"&gt;Read More&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1071632340652365387-1893111983696955533?l=developerinfo.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://developerinfo.blogspot.com/feeds/1893111983696955533/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1071632340652365387&amp;postID=1893111983696955533' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/1893111983696955533'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1071632340652365387/posts/default/1893111983696955533'/><link rel='alternate' type='text/html' href='http://developerinfo.blogspot.com/2006/11/searchdotnetcom-google-custom-search.html' title='Searchdotnet.com - Google Custom Search Engine For .NET'/><author><name>Priyang  Patel</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='22' src='http://bp1.blogger.com/_JBgTe5i3S6g/R_sD6P_EZCI/AAAAAAAAAMw/qkjxFT1PxFg/S220/pri-fair.jpg'/></author><thr:total>1</thr:total></entry></feed>
