In certain scenario like a MVVM view-model, I sometimes needs to have private setter as the view-model exposes a state that can only be modified internally.
So is th
By definition, an interface is a contract for other code to use, not for private members. However, you can specify read-only properties in interfaces and implement a private setter in the concrete class:
public interface IFoo
{
string MyReadonlyString { get; }
}
public class FooImplementation : IFoo
{
public string MyReadonlyString { get; private set; }
}