What’s New in Delphi 2005?[8]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 shiyd 的 blog

declare variable [delphi]

while writing source code, it may happen that you use variables before you declare them. the delphi 2005 refactoring allows you to automatically declare these variables using refactor - declare variable, offering you a dialog to enter the specifics, and adding the variable declaration to the current scope.

this option is only available for variables that are not yet declared, of course, but will allow you to focus on the code and algorithm logic, without having to manually navigate to the beginning of the scope to add a variable declaration. declare variable works well with error insights, when an undeclared variable is highlighted by error insights simply right click on the variable to declare.

declare field [delphi]

similar to declaring undeclared variables, delphi 2005 refactoring offers the ability to declare class fields using refactor - declare field. if the field conflicts with an existing field in the same scope, then the refactoring dialog will allow you to resolve the conflict.

this feature greatly reduces time to extend your classes with fields while writing your source code, without forcing you to return to your class declaration and add the field definition manually.

extract method [delphi]

delphi 2005 refactoring allows you to select a portion of source code (which might be a portion that is repeated in several places, or could be used in other places), and refactor it by turning the code into a method, extracting the selected source code. the refactored method will automatically get a parameter list as well as local variable declarations, and the original section of source code will be replaced by a call to the newly refactored method. breaking long sections of code into methods increases maintainability and reusability.

extract resource string [delphi]

there's nothing harder to localise than a portion of source code that uses hard coded quoted strings inside. delphi 2005 refactoring now allows you to extract these quoted strings and replace them with resource strings (adding the resource string declarations to the implementation section of your code).

import namespace [delphi/c#]

sometimes you use classes, methods, fields or types that are defined in another namespace. in order to add the corresponding namespace to the uses (for borland delphi) or using (for c#) clause, delphi 2005 refactoring offers the ability to automatically import the required namespace for a selected identifier, using refactor - import namespace.

this feature will save you a lot of time looking up namespaces otherwise.

 

本文关键:What’s New in Delphi 2005?
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top