Resharper 4 Beta Released and Downloaded!

I downloaded Resharper 4 beta today. I've been installing several versions of the Resharper 4 EAP as they have been released. Most have been pretty stable over the past month, which makes it no surprise that they released a beta. Yes its a later than most, including myself, expected to see a new version that supports all of the features of .NET 3.5 and Visual Studio 2008 (like LINQ, lambdas, and extension methods) but the EAPs have kept me going. Frankly I have gotten addicted to refactoring tools. Resharper has less eye candy that CodeRush and Refactor Pro, but its more efficient for me.

I'd love to see Developer Express really step up and compete with Resharper on their code analysis and other great aspects. There are some great features from both. But I digress ...

The beta version of Resharper 4 is out, and it supports LINQ and all of the other cool new toys. One thing I love about Resharper is the renaming feature and how it works with XAML. This has been awesome while writing my latest Silverlight projects.

Using the SHIFT - F6 key combination you can rename a variable, class, etc. But you can also do this in XAML and have it update both the XAML and the .NET code in the code behind. I did this below for my sample app where I renamed txtCompanyName to txtAnytext.


But one of the places that really makes Resharper shine for me is when I am writing code for objects and variables that I have not yet created. Now that this works for LINQ, Automatic Properties, and lambdas it makes my life much easier. For example, check out this query I wrote:

List<Person> personList = new List<Person>();
personList = GetPersons();
var query = from p in personList
            where p.City.StartsWith("S")
            select new {p.FirstName, p.LastName, p.Phone};

The Person class does not exist yet nor do the properties for it. Resharper helps create these using some shortcuts, most notably the ALT-ENTER key combination. Using this shortcut on the Person class reference, Resharper first creates the Person class for me. Then I use ALT-ENTER on the property name for City and it gives me this option to create the property:


I can repeat that for the other properties and fill in my class nicely. You can use the F12 key to go to the next "error" in the file. In this case the cursor will jump to the next property that I have not yet defined. So in this code I am basically hitting F12, ALT-ENTER, ENTER,and some TABs to fill in my class and its properties.

    public class Person
        public string City { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public string Phone { get; set; }

It will create automatic properties for you or you can have it create regular property getters and setters. For me, I use a live templates to create my field and property combinations.

Anyway, give it a whirl if you have not tried it. Once you get used to some of the most common tools (Find Usages, Code Analysis, renaming, ALT-ENTER, etc.) you probably won't want to get rid of it.

Tweet Post Share Update RSS

Hi, I'm John Papa. I author this blog, create courses for Pluralsight and am a Google Developer Expert and Microsoft Regional Director. I travel speaking at events and train technology thought leaders