更改接口属性类型是重大更改吗?
这是一个重大的界面更改吗?如果是这样,为什么? (不是家庭作业,只是想确保其他客户端不会因此更改而中断)
当前接口:
public interface MyInterface
{
IPropertyInterfaceOld Propery1 {get; set;}
}
public interface IPropertyInterfaceOld
{
}
建议接口:
public interface MyInterface
{
IPropertyInterfaceNew Propery1 {get; set;}
}
public interface IPropertyInterfaceOld
{
}
public interface IPropertyInterfaceNew : IPropertyInterfaceOld
{
}
Is this a breaking interface change? If so, why? (Not a homework assignment just trying to make sure other clients aren't broken with this change)
Current interfaces:
public interface MyInterface
{
IPropertyInterfaceOld Propery1 {get; set;}
}
public interface IPropertyInterfaceOld
{
}
Proposed interfaces:
public interface MyInterface
{
IPropertyInterfaceNew Propery1 {get; set;}
}
public interface IPropertyInterfaceOld
{
}
public interface IPropertyInterfaceNew : IPropertyInterfaceOld
{
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,这绝对是一个突破性的改变。
如果该属性是读/写的,则更改会破坏此代码:
即使该属性是只读的,也请考虑此类:
该实现会被您的更改破坏。您可能已经更改了项目中声明接口的所有实现,但任何其他实现现在都将被破坏。
(正如评论中所述,这也是一个二进制重大更改。)
Yes, that's absolutely a breaking change.
If the property is read/write, then the change breaks this code:
Even if the property is read-only, consider this class:
That implementation is broken by your change. You may have changed all the implementations in the project that declares the interface, but any other implementations will now be broken.
(It's also a binary breaking change as noted in comments.)