CodeRush FTW: Reorder Attributes

Check out this code block within an ASP.NET forms application:


It's quite wide, and the repetitive attributes that I mostly don't care about are left-most. It'd be nice to move the "runat" and "EmbedInDiv" attributes to the end of these tags. Having "LabelText" first seems nice, right?

CodeRush has a "Reorder Attributes" refactoring, that looks like this:


And you can put it where you want using left and right arrows, like so:


It's got a cute little animation and all, but I'm thinking, "Like I want to do that for each line!"  But then CodeRush surprised me in a good way:


See that "Target: 6 of 8"?  CodeRush says to itself, "It looks like Jason prefers his attributes in this new order. Let's see if he wants to make this same change to all similar elements."  Nice!!!!!

Comments !