Shortcut to convert an expression into a method/function parameter?

已回答

I now think that this is a frequent operation:

  1. You have an expression S, say it is a subexpression of a bigger expression, initializer (E) etc.
  2. Instead of using S as is, you want to pass it to a method/function M and use the return value in E. 
  3. Thus, E = A + B + S + D; would look like E = A + B + M(S) + D;

I use Cmd+w to choose the expression S, but now I don't have a quick way to add the method name and a pair of parentheses to convert it into M(S). Is there a way to do it quickly?

Am I making it clear? (I believe this feature is useful across IDE's)

Regards,

Kedar

0

Refactor | Extract | Method.

0

请先登录再写评论。