今天更新到VS 2008,在寫代碼時想做一些重構(refactor)的操作,卻發現VS的重構沒有提供提取常量(extract constant)的功能。查找了一下,找到了這個著名的第三方重構插件:Refactor!™ Pro https://images.cnblogs.com/cnblogs_com/DotNetNuke/WindowsLiveWriter/ASP.NET_FDDF/image_2.png
支援的重構
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其它參考文檔:
Free refactoring tools for ASP.NET code in Visual Studio 2005