首页 > 解决方案 > 如何强制实现 c# 10 的静态接口属性?

问题描述

c# 10 的静态接口属性显然会自动实现。如何强制覆盖它?

    public interface IModelLogicEventSubsciptions
    {
        static EventSubscriptionType EventSubscriptions { get; }
    }
    public interface AnyClass : IModelLogicEventSubsciptions
    {
        //static EventSubscriptionType EventSubscriptions { get; }
    }

标签: c#c#-10.0

解决方案


解决方案是将接口成员标记为抽象

public interface IModelLogicEventSubsciptions
{
    static abstract EventSubscriptionType EventSubscriptions { get; }
}

推荐阅读