今天升级到VS 2008,在写代码时想做一些重构(refactor)的操作,却发现VS的重构没有提供提取常量(extract constant)的功能。查找了一下,找到了这个著名的第三方重构插件:Refactor!™ Pro
支持的重构
Add AssociatedControlID Attribute | Add Block Delimiters | Add End Tag | |||
Add Parameter | Add RunAt Attribute | Add to Interface | |||
Add Validator | Boolean to Enum | Break Apart Arguments | |||
Break Apart Parameters | Case to Conditional | Change Tag | |||
Collapse Accessors | Combine Conditionals | Compress to Lambda Expression | |||
Compress to Null Coalescing Operation | Compress to Ternary Expression | Conditional to Case | |||
Consolidate Using Statements | Convert to Auto-implemented Property | Convert to Auto-implemented Property (convert all) | |||
Convert to Built-in Type | Convert to Create & Set | Convert to HEX | |||
Convert to Initializer | Convert to IsNothing | Convert to Named Color | |||
Convert to Pixels | Convert to Points | Convert to RGB | |||
Convert to Skin | Convert to System Type | Create Backing Store | |||
Create Method Contract | Create Method Stub | Create Multi-variable Declaration | |||
Create Overload | Create Setter Method | Create With Statement | |||
Decompose Parameter | Encapsulate Downcast | Encapsulate Field | |||
Expand Accessors | Expand Lambda Expression | Expand Null Coalescing Operation | |||
Expand Ternary Expression | Extract ContentPlaceHolder | Extract ContentPlaceHolder (Create Master) | |||
Extract Function (outside of class) | Extract Interface | Extract Method | |||
Extract Property | Extract Script | Extract String to Resource | |||
Extract Style (Class) | Extract Style (id) | Extract to User Control | |||
Extract to XAML Resource | Extract to XAML Resource (replace all) | Extract XML Literal to Resource | |||
Flatten Conditional | For to ForEach | ForEach to For | |||
Inline Alias | Inline Constant | Inline Delegate | |||
Inline Format Item | Inline Macro | Inline Recent Assignment | |||
Inline Result | Inline Temp | Inline With Statement | |||
Introduce Alias | Introduce Alias (replace all) | Introduce Constant | |||
Introduce ForEach Action | Introduce Format Item | Introduce Local | |||
Introduce Local (replace all) | Introduce Parameter Object | Introduce Result Variable | |||
Introduce Setter Guard Clause | Introduce Using Statement | Line-up Arguments | |||
Line-up Parameters | Lock to Try/Finally | Make Explicit | |||
Make Explicit (and Name Anonymous Type) | Make Id Unique | Make Implicit | |||
Make Method Static | Merge Styles | Method to Property | |||
Move Declaration Near Reference | Move Initialization to Declaration | Move Method to Header | |||
Move Method to Source File | Move Style Attributes to CSS | Move Style Attributes to External CSS | |||
Move Style Attributes to Theme | Move Style Attributes to Theme (use SkinId) | Move to Code-behind | |||
Move Type to File | Move Type to Namespace | Name Anonymous Method | |||
Name Anonymous Type | Optimize Namespace References | Promote to Parameter | |||
Property to Method | Reduce Visibility | Remove Assignments to Parameters | |||
Remove Attribute | Remove Block Delimiters | Remove Empty Handler | |||
Remove End Tag | Remove Parameter | Remove Private Setter | |||
Remove Redundant Assignment | Remove Redundant Conditional | Remove Setter Guard Clause | |||
Remove Tag | Remove Type Qualifier | Remove Type Qualifier (replace all) | |||
Rename | Rename File to Match Type | Rename Type to Match File | |||
Reorder Attributes | Reorder Parameters | Replace Temp with Query | |||
Replace with Alias | Replace with Constant | Replace with Local | |||
Replace with XAML Resource | Reverse Conditional | Safe Rename | |||
Set CssClass | Simplify Expression | Split Conditional | |||
Split Initialization from Declaration | Split Multi-variable Declaration | Split Style | |||
Split Temporary Variable | Split With Statement | Surround with Tag | |||
Surround with Update Panel | Toggle ViewState | Use Const (C++ only) | |||
Use IsNullOrEmpty | Use String.Compare | Use String.Format | |||
Use StringBuilder | Use typedef (C++ only) | Using to Try/Finally | |||
Widen Scope (promote constant) | Widen Scope (promote to field) |
博客园老李早有介绍:http://www.cnblogs.com/Terrylee/archive/2007/02/07/free_refactoring_tools_for_aspnet.html
试用版下载:
http://www.devexpress.com/Downloads/Visual_Studio_Add-in/Refactoring/