Skip to main content

All Questions

3 votes
4 answers
348 views

Primary constructors for depedency injection

Microsoft identifies dependency injection as one of the uses for primary constructors. public class ExampleController(IService service) : ControllerBase { [HttpGet] public ActionResult<...
3 votes
2 answers
28k views

How do constructor parameters of a MVC Controller get set?

How does construction work with dependency injection? With the following code: public class AdvancedSearchController : Controller { private EmployeeController _employeeController; public ...
1 vote
2 answers
333 views

Performing serial communication in constructor to initialize an object

I have a class UnitInfo which represents a collection of unit information with methods to get the unit information in a structured way, such as a specific encoding, etc. This unit info consists of ...