Mid From PDF Power Questions High-Impact Interview Questions

Mini Dependency Injection Container?

public class MyContainer
{
private Dictionary<Type, Type> map = new();
public void Register<TInterface, TImplementation>()
{
map[typeof(TInterface)] = typeof(TImplementation);
}
public TInterface Resolve<TInterface>()
{
var impl = map[typeof(TInterface)];
return (TInterface)Activator.CreateInstance(impl);
}
}

More from Career Preparation

All questions for this course
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details