Concerns have been raised by C# developers regarding the use of primary constructors for dependency injection. While primary constructors reduce code bloat, the mutability of parameters can lead to instances being changed in other parts of the class, increasing the risk of runtime exceptions. There are discussions about adding read-only parameters to primary constructors in the future.

2m read timeFrom roundthecode.com
Post cover image
Table of contents
Dependency injection usageWhy is it a problem to lose the read-only part?When we will see read-only parameters?
1 Comment

Sort: