接口属性协变覆盖的语法是什么?
根据规范此处< /a>,
接口方法、属性和索引器覆盖
<块引用>通过在 C# 8.0 中添加 DIM 功能,添加了接口中允许的成员类型,我们进一步添加了对覆盖成员以及协变返回的支持.
我试图让以下协变覆盖起作用,但我找不到语法示例。你能帮忙吗?
public interface IFoo{}
public interface IFuzz:IFoo{}
public interface IBar
{
IFoo Foo {get;}
}
public interface IBaz:IBar
{
//override IFuzz IBar.Foo Foo {get;} //This syntax isn't correct.
}
也许我误解了规范?帮助!
According to the specification here,
Interface Method, Property, and Indexer Override
Adding to the kinds of members that are permitted in an interface with the addition of the DIM feature in C# 8.0, we further add support for override members along with covariant returns.
I am trying to get the following covariant override to work, but I can't find an example of the syntax. Can you help?
public interface IFoo{}
public interface IFuzz:IFoo{}
public interface IBar
{
IFoo Foo {get;}
}
public interface IBaz:IBar
{
//override IFuzz IBar.Foo Foo {get;} //This syntax isn't correct.
}
Maybe I am misinterpreting the specification? Help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
哦。我没有清楚地阅读规范。如果您遇到同样的问题(截至 2022 年 2 月),请参阅上面引用的部分:
它还不存在。
Doh. I didn't read the specification clearly. If you come across the same issue (as of February 2022), this prefaces the above quoted section:
It doesn't exist yet.