Joe White’s Blog

Life, .NET, and Cats


ReSharper, day 28: Really Extract Static Method and Extract Property

Welcome to day 28 of my 31 Days of ReSharper.

Today, I’ll touch on a couple more refactorings (besides Introduce Parameter, discussed yesterday) that you can use in conjunction with Extract Method.

Really Extract Static Method

ReSharper won’t always let you extract a static method (e.g., if the code references instance fields or methods). But you can get there in two steps, by first extracting the method, and then using the Make Method Static refactoring.

ReSharper's Make Method Static dialog box

I haven’t used this refactoring much, so I won’t go into details. I just wanted to note that it’s there.

Extract Property

ReSharper doesn’t have an “Extract Property” refactoring. But you can get there in two steps: first you extract a method, and then you use Method to Property.

ReSharper's Method to Property dialog box

There’s also a Property to Method refactoring, if you ever need to go the other way.

There are no responses to “ReSharper, day 28: Really Extract Static Method and Extract Property” yet.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>


Joe White's Blog copyright © 2004-2011. Portions of the site layout use Yahoo! YUI Reset, Fonts, and Grids.
Proudly powered by WordPress. Entries (RSS) and Comments (RSS). Privacy policy