Jump to content
Sign in to follow this  

Convert local var to Field

Recommended Posts



is there an option to convert a local variable of a method to a field of the current class or record?

I can only find AddField, and the context menu option "Conversion -> convert to Field" is disabled...

Share this post

Link to post

AFAIK, that is not implemented. Local variables are no items in the explorer tree (like fields, methods or properties) and the Convert to Field action can handle only explorer items. This means that implementing such a functionality is not trivial.


A workaround would be place the cursor at the first assignment of the local variable and use <Strg>-<Alt>-F to add a new field. In most cases the type is automatically detected. Either before or after that just delete the local variable manually.

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this