Quick-Fix: Convert Public Field to Property at Cursor
Rewrites a public field under the caret as a property.
Read this when you are tightening a class public surface. With the caret on a lone public field such as Name: TType;, this turns it into a private FName plus a read/write property Name, so existing callers need no change.
Where to click
- RAD Studio main menu: drag-lint > Convert Public Field to Property at Cursor
- Put the caret on the public field declaration in the class
- Choose drag-lint > Convert Public Field to Property at Cursor
- The field is rewritten as a property
Details
Rewrites a public field under the caret as a property. Reach for it when tightening up a class's public surface.
Running it from the CLI
No CLI equivalent - this action is in-process only.
What it needs
n/a. This action runs in-process against the open editor buffer; the feature map does not mark it as needing a separate index step.
Example
Illustrative only: place the caret on a public field -- for example
FCustomer: TCustomerOrder; exposed directly on TfrmMain -- and invoke the
quick-fix to convert it into a property.