c# - 如何强制实现 c# 10 的静态接口属性?
问题描述
c# 10 的静态接口属性显然会自动实现。如何强制覆盖它?
public interface IModelLogicEventSubsciptions
{
static EventSubscriptionType EventSubscriptions { get; }
}
public interface AnyClass : IModelLogicEventSubsciptions
{
//static EventSubscriptionType EventSubscriptions { get; }
}
解决方案
解决方案是将接口成员标记为抽象
public interface IModelLogicEventSubsciptions
{
static abstract EventSubscriptionType EventSubscriptions { get; }
}
推荐阅读
- python - 覆盖 sqlalchemy.connect 上的现有数据库
- javascript - 在 wordmap 中的 d3.js 中渲染六边形
- java -
导入项目时在 .classpath 文件中被覆盖 - javascript - 消除数组中较小的值
- c - 代码在达到交换功能后停止,如果我将其注释掉,它会完美运行
- c - 关于 C 语言文件的 rewind() 函数的问题
- c++ - 不理解以下关于编译器可能对普通 {} 定义执行 `memcpy` 优化的评论
- java - 回调函数作为Java中的参数
- angular - 我无法通过 DTO 模式组织数据并将数据发送到 angular2 上的服务
- javascript - 如何使用电话号码登录设置 React 和 Firebase 身份验证?