A method's body is just as clear as its name.
Put the method’s body into the body of its callers and remove the method.Sample:
BeforeRefactor
1public int GetRightNumber()2{3 return (MoreThanFive()) ? 2 : 1;4}56public bool MoreThanFive(int number)7{8 return number > 5;9}
AfterRefactor
1public int GetRightNumber()2{3 return (_number > 5) ? 2 : 1;4}
转载于:https://www.cnblogs.com/nanshouyong326/archive/2007/04/20/721296.html
相关资源:数据结构—成绩单生成器