New IDE Features in Visual Studio 2010 for C# Developers

New IDE Features in Visual Studio 2010 for C# Developers

Rate This
  • Comments 26

After a quick review of C# language features, let’s do the same for the IDE improvements. So, what’s in there for C# developers?

Generate From Usage

This feature greatly improves Visual Studio support for test-driven development (TDD). However, it is useful even if you don’t use TDD at all. It might increase your productivity by simply reducing the number of keystrokes and eliminating repetitive typing. For example, now I can write code like this:

class Program
    static void Main(string[] args)
        var test = new SampleClass(firstParameter: "test", secondParameter: 0);
        test.FirstProperty = 1;
        test.SampleField = 2;
        int value = test.SomeMethod(100);

SampleClass doesn’t exist at this moment, so everything is going to be highlighted as an error. But instead of typing all the declarations, I set the cursor on the highlighted error, press CTRL + “.” and have the IDE generate code for me.


Visual Studio 2010 can generate classes, constructors, properties, fields, enum members, and methods (and it uses the names of optional parameters from the constructor or method calls). Just look at how much code I didn’t have to write. All this was generated by simply pressing CTRL + “.” several times.

class SampleClass
    private string firstParameter;
    private int secondParameter;
    public int SampleField;

    public SampleClass(string firstParameter, int secondParameter)
        // TODO: Complete member initialization
        this.firstParameter = firstParameter;
        this.secondParameter = secondParameter;

    public int FirstProperty { get; set; }

    internal int SomeMethod(int p)
        throw new NotImplementedException();

However, sometimes IntelliSense, which is so nice when you’re dealing with already-defined classes, may get in your way when you try this “generate from usage” approach. For example, suppose that I want to add another property to SampleClass and call it First. Since I already defined FirstProperty, IntelliSense autocompletes First to FirstProperty when I type “=”.

To avoid this problem, press CTRL+ALT+SPACEBAR to switch to IntelliSense suggestion mode (as opposed to completion mode). In suggestion mode, IntelliSense is less aggressive – it doesn’t autocomplete member names after you type an equal sign or open parenthesis or something like that. But you are still able to choose an existing member from a list if you need to complete the member name.


Check out Generate From Usage and List Members topics on MSDN to learn all the details about this feature.

Call Hierarchy

The new Call Hierarchy window helps you analyze your code and navigate within it. I opened one of the LINQ sample projects that come with Visual Studio. (Click Help and then Samples on the Visual Studio menu to get the list of samples.) I chose the WebServiceLinqProvider sample, since it’s a fairly big one.

Now, to open the Call Hierarchy window, I can put the cursor on any method, property, field, indexer, or constructor, no matter whether it’s a declaration or an actual call, right-click it then and click View Call Hierarchy (or press CTRL+ALT+K). Call Hierarchy is also available if you right-click a member in the Object Browser or in Class View.


For me, the biggest advantage of this window is that under the Call To node you can see which members call the selected member, and where those members are. This information is often hard to get and analyze, since member calls are usually scattered across the project.

In the same window, under the Calls From node, you can also see which members the selected member calls. For virtual and abstract members, you can see the overrides.

What’s cool is that you can navigate from this window to the code you want to look at in more than one way. First of all, you can see what the method call looks like in the Call Sites column. You can also see the name of the file that contains this code.


Second, you can double-click any method call and Visual Studio will open the method for you.

But if you want to still see the method you are analyzing, there’s third way. Open the Code Definition window and move it so you can also see the code editor and the Call Hierarchy window. (The best place would be a second monitor, and this is now easy to do with all these undockable windows, thanks to the new WPF UI.) Now if you click on a method call (instead of double-clicking), you can see the corresponding code in the Code Definition window, without losing your position in the main editor.

Don’t forget to check out the shortcut menu, which allows you to use such commands as Go To Definition, Find All References, and Add as New Root for each member.

Navigate To

Speaking of navigation improvements, the next cool IDE feature is a quick search tool for symbols. Just press CTRL + “,” (or click Edit and then Navigate To) to see the new Navigate To window. You can search for types, members, and files in this window. Camel-case search is supported as well. Everything is displayed in one result list. In the following screenshot, you can see a class, a constructor, and a file whose capital letters match my search request. And it goes without saying that you can navigate to any item with a simple double-click.


Reference Highlighting

This is one of those subtle features that just make things better. If you put the cursor on a symbol (method, property, variable, etc.), all instances of this symbol are automatically highlighted in the code editor. You can also navigate from one instance to another within a file by pressing CTRL+SHIFT+UP/DOWN ARROW. How to: Use Reference Highlighting on MSDN describes how you can configure the highlighting color and turn on/off the feature (it’s turned on by default).


Box Selection and Multiline Editing

Suppose that you want to change several fields in your class from public to private. And you have a couple dozen of those. Now you change the declaration by typing public just once. Press ALT and then use your mouse or arrow keys to select the box area (in my case, the column that contains the private keywords).


Now simply type the new text and it will be repeated on each line. Check out this nice video from the Visual Studio Editor team, which shows more scenarios where this feature may come in handy (adding comments, writing repetitive code, etc.).

Docking Windows and Zoom

I already mentioned that moving Visual Studio to WPF helped to improve multiple-monitor support. In fact, you can undock any window and rearrange everything according to your needs. Dock windows to the edges of the main window, or simply leave them in the middle of the screen if you want.

Another useful feature enabled by WPF is zooming. Press CTRL and use your mouse wheel to enlarge or decrease your font size. The C# team does a lot of presentations, and I can tell you that it’s much easier to give (and see) a demo now.

Extension Manager

If you’re still looking for ways to improve your IDE, try one of the numerous add-ins developed by the community and other companies. In this release, Visual Studio greatly improved its SDK for add-in developers. Also new is the Extension Manager, which helps you to easily download, install, and uninstall Visual Studio extensions. You can get to it by clicking Tools and then Extension Manager.

Now you can search for add-ins online without leaving the IDE. The Extension Manager checks for add-ins and their updates at Visual Studio Code Gallery.


What Else?

No, this is not all that’s in there for you. I just mentioned the most popular features that might be useful to any C# developer, no matter what technology or API you use.

There are a lot of subtle improvements that might be hard to notice. For example, error highlighting now works in more places. Another example is IntelliSense, which now supports camel casing and filtering in all of its lists.

Also, a lot of enhancements are specific to certain technologies: Office development, WPF, Silverlight, SharePoint – just to name a few. I also didn’t mention improvements in the debugger or application lifecycle management .

Instead of providing tons of links, I’ll provide just one: Visual Studio 2010 Product Highlights. This document briefly describes major Visual Studio improvements and provides all necessary links to relevant MSDN docs.


Special thanks to Kirill Osenkov, Alan Berman, and Mick Alberts for reviewing, editing, and providing helpful comments.

Leave a Comment
  • Please add 8 and 8 and type the answer here:
  • Post
  • Very nice... VS2010 is a rocks solid IDE.

    Thanks for the post. Very helpful.


  • I created a new Console Application in VS 2010 Professional with 4.0 Framework selected.  Then I typed the four lines you have above into the Mail method.  When I clicked Generate Class on SampleClass, however, I get a new SampleClass.cs file that only has:

    class SampleClass



    And I immediately have several errors including SampleClass does not contain a constructor that takes 2 arguments.

    What am I missing here?

  • Nevermind, I figured it out.  I didn't catch the "generated by simply pressing CTRL + “.” several times" on the first read through.

    So it isn't actually looking at how the class is being used when generating the class (which was what I thought from the name Generate From Usage).  This is just an expansion of the Generate Method to include classes, constructors, and properties.

  • @ Sheridan

    Yes, you are right. It only analyzes the line where the undefined symbol is used. And you have to press CTRL + "." for each item you want to generate.

  • After a decade at last we got column selection feature in VS IDE :)

  • Good to see that some of the features that have previously been provided by third party plugins are making their way to becoming standard features of the Visual Studio IDE. A productivity boost for everyone.

  • Hi boss, the Column selection and auto-generate type are already there is VS2008 ;-)

    I suppose it’s not the new feature in VS2010

  • Column selection has been in the VS .NET IDEs since the start and in Visual C++ since at least VC++ 5.0. However, it has been enhanced in VS 2010.

  • Quite impressive, especially "Generate from usage" and "Navigate To" features!

    Well, JetBrains ReSharper users (and me among them) have been enjoying such tools for years now. However, once in a while I am in a situation where ReSharper is not available, e.g. pair programming with somebody on the project not using it. These new VS features will be a good help for me on such occasions..

  • @Rameshb

    Box selection was there, but multi-line editing is new.

    As for code generation, I recall that "generate method stub" was there, but not "generate type".

    But overall, I tried to concentrate more on new things that you can do now, not on drawing a line between old and new features. Even if some features were partly implemented before, now they become much more useful.

  • "Hi boss, the Column selection and auto-generate type are already there is VS2008 ;-)"

    There was column selection but without mulitline editing.

  • Can call hiearchy be extended to find

    - public methods that can be made private (i.e., callled from within the same class)

    - public methods called by only one other class (i.e., could be moved from existing class to the other class and made private)

    - Unused methods, member variables, classes, constants

    - Classes that are used by only one other class which could be nested within that class

    - File level call hiearchy to find objects in files that are called by cde in only other other file (i.e., merge the two files together)

    - Classes having no member variables which have non-static methods (that could be made static).

    - Class level call hiearchy showing classes called only by classes in another project (i.e., so that the class in project A could be move to project B since project B is the only user of that class)

    - Projects unreferenced by any code outside of that project (i.e., all classes in a project are not called or used by any other class.  This would let the entire project be removed from the solution).

    These all involve finding an simplifying the structure of a class, project and entire solution so that each object, project and solution has access to only the most minimal set of things outside of itself.

    This also leads to simplification of the entire application solution by reducing the entire code base into a single project solution with a minimal number of source code files.

    This technique is commonly used used by mainframe and C embedded systems developers when working with large code bases.

  • Thanks Very Nice Post,Keep Post More

  • Thanks  for this wonderful post,  the pictures are self-explanatory and language is vibrant and goes in the flow. In all, beautiful article. I expect more article from you in the upcoming sessions.


  • new IDE features to generate codes for classes,constructors etc. is a very very intelligent feature

    thanks a lot

Page 1 of 2 (26 items) 12