Method Chaining

Method chaining is a technique whereby one method overload calls another method overload.

The purpose of method chaining is to reduce repeated code between the overloads, so there is one primary overload with the majority of the code.


  • Do consider using method chaining to minimize repeated code in method overloads.
  • Do consider using an optional parameter instead of overloads and chaining to minimize repeated code.
  • Avoid if it adds complexity. 

Comments

Popular posts from this blog

Method Overloading

Building a Method