Introduces a new local variable instead of multiple assignments to the same variable.
Sometimes a local variable can take on multiple personalities, playing different roles through the life of a method. This makes code harder to read, because the role of that variable depends on its position in the code. This refactoring cleans up the mess, creating a new local variable for the next assignment.
Sometimes this refactoring may become available on locals that are assigned to multiple times yet play a single consistent role throughout the code block (e.g., accumulating a total or checking for errors). It is unnecessary to split the local when used in this manner.
int a; a = 15; Method1(a);a = 20; return Method2(a);
Dim a As Integer a = 15 Method1(a)a = 20 Return Method2(a)
int a; a = 15; Method1(a); int splitA = 20; return Method2(splitA);
Dim a As Integer a = 15 Method1(a) Dim splitA As Integer = 20 Return Method2(splitA)