When to use this:
- Length of the method is not an issue
- To improve clarity of the code
- The name of the new method will reveal the intention of the code in a better way. If you can't come up with a more meaningful name, don't extract the code
Example : Suppose we have method to use this extract method. by selecting console.WriteLine statement as below
public void Add(int x, int y)
{
int z = x + y;
Console.WriteLine(z);
}
No comments:
Post a Comment