Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • So what you are suggesting is that, since the filecreator cannot be injected, instead a factory object could be injected. For example, FileCreatorFactory. This factory could expose a method named GetCreator(StreamWriter writer) which would simply pass the writer in the constructor of the FileCreator, and return a IFileCreator? Commented Nov 19, 2019 at 19:10
  • @user1861857: Yes, precisely. The file creator factory is an additional level of indirection, but it allows for DI and polymorphism to play nicely with the need for runtime data. Commented Nov 19, 2019 at 19:16