This is a migrated thread and some comments may be shown as answers.

Problem with Extract Method Selection

1 Answer 20 Views
Refactorings
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Steve
Top achievements
Rank 2
Veteran
Steve asked on 05 Aug 2011, 02:18 PM
Ok so here's the line

newItem.PickTypeID = Convert.ToByte((oldItem.DoesResidentPickThisApprover == true) ? 2 : 0);

So I needed to expand on the logic to the right of the =

So I selected everything after convert and extracted the method and it removed the newItem.PickTypeID = and converted the ENTIRE line into a new method

GetPickType(newItem, oldItem);

...can this be fixed please?

1 Answer, 1 is accepted

Sort by
0
Svetlozar
Telerik team
answered on 05 Aug 2011, 02:31 PM
Hi Steve,

Execute me If I am missing something.

You want to extract the right side of the assignment, right?

In that line you have a statement with an expression. If you want to extract only the expression you have to select only the expression (without ;), otherwise we expand to the enclosing statement, which is the assignment.

Greetings,
Svetlozar
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Tags
Refactorings
Asked by
Steve
Top achievements
Rank 2
Veteran
Answers by
Svetlozar
Telerik team
Share this question
or