Skip to content

re: The Builder Pattern .net core VIEW POST


Hi Gray

Thank you for the article.
I have a small remark for the last example. If we want to 'lock' the builder in order to force using the 'Create' method, I think we should implement a private constructor, for the builder, and make 'Create' method static. In this way, we will be sure that we will have at any moment an instance of Person. Because right now, if I will call 'new PersonBuilder().Occupation(_something).Build()' it will fail because there's no instance for the '_person' yet created.

Good luck.


Thanks for the feedback.

I will attempt to update the article to incorporate your input.


code of conduct - report abuse