Readonly makes a lot of sense in situations where you pass a link to a service through a constructor, i.e.
public class MyViewModel { private readonly MyContext context; public MyViewModel(MyContext context) { this.context = context; } }
Obviously, you do not want your context to be overwritten by others, because you can have many things that depend on this particular service inside the class. And if this is a constructor parameter, it usually means that you are RELY on this particular service or object to create and maintain the actual state of the object. So readonly is a good indicator of just that. Having a private set in a property means that you cannot change it outside the class; readonly is an additional restriction that makes things more secure and understandable.
Bruno altinet
source share