Dependency injection · interview question
Complete the registration so a new instance is created every time IFoo is resolved: builder.Services.Add_____<IFoo, Foo>();
Fill in the blankEasy
Answer and explanation
Correct answer
Transient or AddTransient
Why
AddTransient creates a new instance per resolution. It suits lightweight, stateless services.
Test yourself on Dependency injection
A free test with instant, explained results. No account needed.