New in Visual Studio 2010: Call hierarchy

Call Hierarchy is something which I think will be a very handy new feature in VS2010. First of all you can see which parts of your code are making a call to a specified method and then you can see which calls are made from this method..and so on. To specify your method just right click on the method name and select View Call Hierarchy. Shortcut for Call hierarchy is CTRL + ALT + K.

image

This will show you what calls are made to the method and also which calls are made from that method. This is very if you need to know where a certain method is used. You also have Find All References. I know that but that’s not comparable with Call Hierarchy. The level of detail with Call Hierarchy is much bigger. As you can see in the screenshot below, you can drill down, see the complete calling structure. You get the idea…

image

If you have an interface and want to know which concrete classes are using your interface, then you can also use Call hierarchy:

image

View this post to see all the new features of VS2010 which I have discussed

New in Visual Studio 2010: Navigate to…

“Navigate to” is just a simple way to find a certain method ASAP without using the search. I could do this kind of searching for a method already before with ReSharper. But if I have to be honest, I think Navigate to will be used more. I’m not to sure because I don’t know all the ReSharper shortcuts, but with ReSharper I had to push two shortcuts. First I had to look for the object, then when I would be in the object, I had to search for the method. With Navigate to.. once you start typing it will go look for anything that matches that criteria. Class, property, method..doesn’t matter.

image

View this post to see all the new features of VS2010 which I have discussed

New in Visual Studio 2010: More then one IDE

From now on you can run VS2010 and VS2008 on the same machine. This is new, because back in the day when I was working with Visual Studio 2005. When I tried to install VS2008, I first had to remove VS2005. For me this was a problem at the time because if you are working on a project in VS2005 and open it in VS2008, it will convert it. When you are a alone, that’s no issue, but if you are in a team and not everybody want to upgrade, then there’s an issue. Of course there are ways to overcome this problem, but that’s not advisable. Anyway, the problem will be the same here. Once you upgrade your solution to VS2010, you will also not be able anymore to open it in VS2008. But now because there are 2 IDE’s on the same machine, you are not immediately forced to upgrade the solution.

View this post to see all the new features of VS2010 which I have discussed

New in Visual Studio 2010: Pin the solution

Do you also hate it when you are working with multiple solutions and that one project that you need to access a lot, always gets kicked off the recent projects list in the VS start page? No worries anymore! This is solved now! We can now pin the solution in the start page. Just like you can pin an application to the start menu.

This way we will never have to go look for it again.

image

View this post to see all the new features of VS2010 which I have discussed

New in Visual Studio 2010: Code Zooming

When I need to do a demo for a group of people and beam my code, there is always somebody who asks if I can maybe enlarge the font size of the code. Then you need to go into the options window and start looking. (Where can I change that font size again…) From now one this has become much easier in VS2010. Now you can just change the size in your code document

image

Or you could just hold down the CTRL key and scroll up or down. This will have the same effect

View this post to see all the new features of VS2010 which I have discussed

What’s new in Visual Studio 2010?

Well there are a lot of new things in Visual Studio 2010. The whole UI changed actually, you’ll probably have noticed that already. There are however a lot of small things, which I think are in fact completely new for you. In the upcoming posts I’ll talk about these new features.

Coming back to the new UI. I believe that moving the IDE’s UI to a WPF powered UI has brought a lot of new opportunities to the table. For me, they didn’t have to this. You also maybe think about it this way. But in the upcoming posts you will see that it has it’s advantages.

So register to the RSS because I can guarantee, a lot of posts will follow

New features discussed:

Disabling ReSharper 5.0

I am really a big fan of ReSharper! With Visual Studio 2010 I had to upgrade to version 5.0, which is currently in beta. Haven’t played with all the new features but this will come. I’m sure. Anyway..

I was looking at some new functionalities Visual Studio 2010 had to offer. Wanted to try out the new native Generate code based on usage. The problem however, well problem, is that ReSharper already had this functionality before. So if I try to call a method which is not defined in my class, ReSharper will immediately ask if it needs to create that method for me. But I wanted to see Visual Studio 2010 doing that. So I had to find a way to stop ReSharper from helping me out. Didn’t want to uninstall so I had a look in ReSharper and Visual Studio’s settings. Then I noticed that it can be done very easily from the Visual Studio Options window (Tools – Options …). Look for the ReSharper node.

 

image

As you can see, there is a button to suspend ReSharper. This click will temporarily remove all ReSharper’s power. Afterwards you can of course enable it again without a problem.

Screencast: Visual Studio 2010 – New debugging experience

In this screencast I will have a look at the new debugging features that are introduced together with Microsoft Visual Studio 2010.

Questions that will be answered in this video are:

  • What is collaborative debugging?
  • What’s new when it comes to breakpoints?
  • What are datatips and how can they help me while I’m debugging?
  • what is IntelliTrace, previously known as historical debugging and how can it improve debugging?

You will see that the lack of good collaborative debugging is a subject that they have tackled with Visual Studio 2010.
If you have any questions or remarks. Please post a comment or send me an email!

Visual Studio 2010 – New debugging experience from Sven Vanoirbeek on Vimeo.

Windows 7 GodMode

Want to control Windows 7 at a whole different level?

Create a folder and name it: GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}

Open that folder and you will see a lot of settings that you can change, all in one place. Isn’t that handy?

image

Better Office COM interop thanks to named and optional parameters

In my last screencast I showed you how to work with two new features in C#4.0 which are named and optional parameters. Now in this post I will show you another way how you can benefit from these new features.

Remember when you had to create these Microsoft Word document with the Office interop API and had to pass all these tedious by ref parameters. Things you absolutely didn’t care about! But anyway the Office COM Interop assemblies were expecting them. Thanks to named and optional parameters this will all go away!

So let’s first start with adding a reference to the Microsoft Office Word Interop assembly.

image

Following is the code we had to write before we could use named and optional parameters.

class Program
{
   static void Main(string[] args)
   {
       object missing = System.Reflection.Missing.Value;
       object visible = true;

       //Create instance of Word application
       Word.Application wordApp = new Microsoft.Office.Interop.Word.Application();
       //Make the Word application visible
       wordApp.Visible = true;
       //Create instance of Word document
       Word.Document wordDocument;

       //Add document to document collection of word instance
       wordDocument = wordApp.Documents.Add(ref missing, ref missing, ref missing,ref visible);
       //Type text in our Word document
       wordApp.Selection.TypeText("This is my dynamically created word document");

       Console.WriteLine("Done");
       Console.In.ReadLine();

   }
}

As you can see we had to define this missing object and pass it when we added our Word document to the documents collection of the Microsoft Word application instance. This doesn’t mean that much but hey we had to add it anyway to make it work. Now with optional parameters this isn’t needed anymore. We can just leave them out!

wordDocument = wordApp.Documents.Add(ref visible);

Will this do the trick then? Well not really because now you have removed 3 missing objects and are left with the visible Boolean. To make it really work, we have to define which parameter the visible object represents. This can be done with the named parameter feature. Now the method call will look like this:

wordDocument = wordApp.Documents.Add(Visible:ref visible);

Isn’t this so cool? But wait it gets even better. Another new feature of C# 4.0 is that we don’t need to explicitly pass parameters by reference anymore. So we can clean our code up some more. Finally we will end up with this piece of code, which is by the way much more readable.

class Program
{
   static void Main(string[] args)
   {
       //Create instance of Word application
       Word.Application wordApp = new Microsoft.Office.Interop.Word.Application();
       //Make the Word application visible
       wordApp.Visible = true;
       //Create instance of Word document
       Word.Document wordDocument;

       //Add document to document collection of word instance
       wordDocument = wordApp.Documents.Add(Visible:true);
       //Type text in our Word document
       wordApp.Selection.TypeText("This is my dynamically created word document");

       Console.WriteLine("Done");
       Console.In.ReadLine();

   }
}