ASP.NET Core basics · interview question
What does the [ApiController] attribute add to a controller?
Multiple choiceMedium
Answer and explanation
Correct answer
A. Automatic HTTP 400 responses when model validation fails, plus binding-source inference such as [FromBody] for complex types.
Why
[ApiController] enables API-friendly conventions: attribute routing requirement, automatic ValidationProblemDetails 400s, binding-source inference and problem-details responses for errors.
References
Test yourself on ASP.NET Core basics
A free test with instant, explained results. No account needed.