Blue Theme Orange Theme Green Theme Red Theme
 
Nevron Gauge for SharePoint
Home | Forums | ASP.NET 2.0 Tutorials | Web Services | How Do I...? | Class Browser | WPF Quick Starts | Advertise with Us
 | Consulting  
Submit an Article Submit a Blog 
 Jump to
Skip Navigation Links
TechnologyExpand Technology
WebsiteExpand Website
6 Months Free & No Setup Fees ASP.NET Hosting!
Search :       Advanced Search »
Home » Visual Studio 2005 » Whidbey C# IDE Features

Whidbey C# IDE Features

An overview of the new IDE features introduced in Visual Studio 2005 codename Whidbey.

Page Views : 3985
Downloads : 0
Rating :
 Rate it
Level : Beginner
   Print Read/Post comments Post a comment  Similar Articles  
   Email to a friend  Bookmark  Author's other articles  
 
Team Foundation Server Hosting
Become a Sponsor
 Tag Cloud
 Latest Jobs
More ... 
 Latest Interview Questions
More ... 

Visual Studio 2005 is going to be released shortly. Whidbey is the codename for this.

 

Here, I want to share some of my knowledge about new IDE features of C# 2.0

 

1. Code Expansions: -

 

A.      When we want to include a property for our code, it is very simpler than pervious. Just type 'prop' and hit tab, you will get the property skeleton as shown below.

 

               PropExpansion

            You can edit the names marked in yellow color.

B.      Also, if you want to add a class, it's very simple. Type 'Class' and hit tab, you will get the skeleton as shown below.

             

 You can edit the names marked in yellow colors.

 

The same way, you can get the code templates for Enum, Struct, switch statement, for loop, foreach loop, if, do-while, else loop.

      

C.      You can also create your own code expansion templates using defined XML schema

 2. Refactoring: -

      A.      Renaming

You can use refactoring to intelligently rename a variable, parameter, method, or a type. Intelligently means that the refactoring tool will distinguish between literal names and words in comments, and different versions of an overloaded method. That is, when renaming a method, you will get the option to change the name of that particular version of the method (in its definition and all its call sites), or all overloaded versions of that method.

If you want to rename you don't have to find and replace everything. Go to the variable, Right Click, choose Refactor and select Rename it gives a windows to enter the new name. After entering a new name, a new window opens that displays the places where the changes will take place. You can view and accept the changes

B.     Method Extraction

Refactoring method extraction lets you convert a section of in-line selected code into a method. The extraction removes the original code section, places it into a new private method, and injects a call to the new method in place of the extracted lines.

     Before Extracting to method: -

   BeforeRenaming

  After Extracting to Method: -

 AfterRenaming

When you generate the extracted method signature, the refactoring engine follows the following rules:

1.      Any local variable that is defined before the selected code but is used in it becomes an input parameter.

2.      Any such local value type variable that is changed by the selected code will be converted to a by-reference parameter (using the ref qualifier).

3.      If the selected code does not use any member variables, it will be extracted to a static method.

C.     Field Encapsulation: -

This handy refactoring feature allows you to generate a property around a class member. You can use it to encapsulate a public field or to expose a private field as public property. For example, suppose you want to expose the m_Number member variable as a public property:

public class MyClass
{
Int m_Number;
}

Place the cursor on m_Number and select Encapsulate Field... from the Refactor menu. This will bring up the Encapsulate Field dialog box

Encapsulate Field can recognize a commonly used member variable naming convention and generate the appropriate property name out of it. Meaning, if the member variable is prefixed with m_ or just _, the Encapsulate Field will omit that prefix when suggesting a property name. Of course, you can specify any property name you like.

If you want to make a variable as property, it is very simple. Right Click and select Refactoring and Encapsulate Field. It will add the get and set methods for that particular field.

D.     Reorder Parameters

Refactoring allows you to change the signature of a method by adding or removing parameters, and refactoring allows you to change the order of parameters. However, you cannot change the method returned type. You can change the signatures of methods, indexers, and constructors.

For example, suppose you want to change the order of parameters in Add() method in the following Calculator class parameters:

public class Calculator
{
public int Add (int number1, int number2)
{
return number1+number2;
}
}

Right-click anywhere inside the method and select Reorder Parameters from the Refactor popup menu. Use the dialog to change the order of parameters by moving parameters up or down

If you want to Remove Parameters of the method, Right Click, select Refactor and Remove Parameters. You will get a small preview window. In the window you can view the changes and apply the changes.

3. Intellisense: -

The last two refactoring features "Surround With and Expansions" are about code typing automation rather than code layout and structure.

a)    Surround with generates a template with blank place holders for commonly used statements (such as foreach or exception handling) around a selected code section. For example, to automatically generate a foreach statement around a trace statement, highlight the statement, right-click, and select Intellisense from the pop-up menu, then choose Surround With... and then select For Each

b)    If you type "List<products> myList = new" now you will get the datatype automatically although it is a user defined generic datatype...intellisense works fine here.

 

4. Debugger Visualization: -

The C# IDE has a built-in class designer based on the one in Visio (in terms of functionality). Its look and feel is completely different though.

If you are dealing with the XML file, just go to the xml file types and right click on it. You can view the file data as xml, html or text.

Custom type viewers can be created for debugging purposes that allow you to view, while debugging, a dataset for example. These viewers are extensions to the IDE that can be created by you.

Comment Request!
Thank you for reading this post. Please post your feedback, question, or comments about this post Here.
Login to add your contents and source code to this article
 [Top] Rate this article
 
 About the author
 
Prabhu Kumar Kambhampati
Prabhu is a Senior Project Engineer and having more than 3+ years of experience in .Net environment. Prabhu is a Microsoft Certified Professional (MCP) in .Net. His Major expertise is in Microsoft .Net Technologies and have working experience in ASP.Net, C#.Net and also in VB.Net. His area of interest is Windows and web application development. Working with Whidbey from more than an year.
Looking for C# Consulting?
C# Consulting is founded in 2002 by the founders of C# Corner. Unlike a traditional consulting company, our consultants are well-known experts in .NET and many of them are MVPs, authors, and trainers. We specialize in Microsoft .NET development and utilize Agile Development and Extreme Programming practices to provide fast pace quick turnaround results. Our software development model is a mix of Agile Development, traditional SDLC, and Waterfall models.
Click here to learn more about C# Consulting.
 
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
ASP.NET 4 Hosting
Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites – Click Here!
 
 Post a Feedback, Comment, or Question about this article
Subject:
Comment:
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
 Comments
Team Foundation Server Hosting
 © 2012  contents copyright of their authors. Rest everything copyright Mindcracker. All rights reserved.