Next our example has us calling WrittenBy. Well, the BookBuilder class doesn’t define that method. In a normal application we’d probably just add the method to BookBuilder, but that wouldn’t let us play with extension methods here, so let’s pretend that the BookBuilder class is defined by some code we don’t control and can’t modify.
It's a very valid question. The answer is "I need to teach extension methods". If you have full control of all code, you're better off putting it in BookBuilder.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
(I emphasised the main purpose)
It's a very valid question. The answer is "I need to teach extension methods". If you have full control of all code, you're better off putting it in
BookBuilder
.