小智 6
只需在界面中添加getter即可.
public interface Foo{
bool MyMinimallyReadOnlyPropertyThatCanAlsoBeReadWrite {get;}
}
Run Code Online (Sandbox Code Playgroud)
接口指定对象必须实现的最小值; 它没有说明对象不能做什么.为此,您需要研究创建基类.
接口就像盐:到处洒:
public interface ICanBeSecure
{
bool IsSecureConnection { get; }
}
public interface IIsSecureable : ICanBeSecure
{
bool IsSecureConnection { get; set;}
}
Run Code Online (Sandbox Code Playgroud)