In the past I had quite some reusable code in my project which I would like to put inside a custom class library project so other projects can reuse it. There is only just one piece of code which needs configuration in code which is project dependent.
How can I inject a method to be executed in my project inside a method of the class library? I was thinking about using a delegate but am open for suggestions. If you have some code, I am not that great with delegates, please post as well.
You’re looking for different ways to achieve IOC/Dependency Injection. A common way is to take a parameter which implements:
If you’d like to use delegates you could use:
Usage: