I use IoC and DI for my project.
However, I was wondering if there is any good practice:
private readonly IMyService myservice;
as a field inside a class that is a consumer of a service. The field is specified in the constructor.
I am sure I saw it somewhere, and I took it. However, I also see:
private IMyService myservice;
and that seems to be enough. Is there any purpose to have a readonly field for the entered service interface? What are the benefits?
jaffa source
share