如何强制执行 c#10 的静态接口属性?
How to enforce c# 10's static interface properties to be implemented?
c# 10 的静态接口属性显然是自动实现的。如何强制覆盖它?
public interface IModelLogicEventSubsciptions
{
static EventSubscriptionType EventSubscriptions { get; }
}
public interface AnyClass : IModelLogicEventSubsciptions
{
//static EventSubscriptionType EventSubscriptions { get; }
}
解决方法是将接口成员标记为abstract
public interface IModelLogicEventSubsciptions
{
static abstract EventSubscriptionType EventSubscriptions { get; }
}
c# 10 的静态接口属性显然是自动实现的。如何强制覆盖它?
public interface IModelLogicEventSubsciptions
{
static EventSubscriptionType EventSubscriptions { get; }
}
public interface AnyClass : IModelLogicEventSubsciptions
{
//static EventSubscriptionType EventSubscriptions { get; }
}
解决方法是将接口成员标记为abstract
public interface IModelLogicEventSubsciptions
{
static abstract EventSubscriptionType EventSubscriptions { get; }
}