IServiceCollection in C# – Simplified Beginner’s Guide For Dependency Injection
Learn about IServiceCollection in C# and dependency injection. See how Dependency Inversion, Single Responsibility, and Open/Closed Principles fit together!
Learn about IServiceCollection in C# and dependency injection. See how Dependency Inversion, Single Responsibility, and Open/Closed Principles fit together!
I love dependency injection frameworks ever since I started using them. Specifically, I'm obsessed with using Autofac and I have a hard time developing applications unless I can use a solid DI framework like Autofac! I've recently been working with Xamarin and found that I wanted to use dependency injection, but some of the framework doesn't support this well out of the box. I' was adamant to get something going though, so I wanted to show you my way to make this work. Disclaimer: In its current state, this is certainly a bit of a hack. I'll explain why I've taken this approach though! In your Android projects for Xamarin, any class that inherits from Activity is responsible for being created by the framework. This means where we'd usually have the luxury of passing in dependencies via a constructor and…