向后兼容性在改变基类 [英] Backwards compatibility when changing base class

查看:118
本文介绍了向后兼容性在改变基类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在.NET中,我保持二进制兼容性当我设置一个新的基类,一类是早期没有任何基类(继承从System.Object)?

In .NET, do I maintain binary compatibility when I set a new base class for a class that earlier didn't have any base class (inherits from System.Object)?

推荐答案

一个快速的测试表明,它没关系,但我个人会是的非常的紧张这样做无需重新编译的。你会基本上是你无法从源头code复制,而无需通过相同的步骤的状态 - 建库,建调用code,更改库,重建刚刚库code

A quick test suggests it's okay, but personally I'd be very nervous of doing this without recompilation. You would basically be in a state which you couldn't reproduce from source code without going through the same steps - build the library, build the calling code, change the library, rebuild just the library code.

行为可以以微妙的方式了这些东西,扩展方法和重载改变。它的的清洁剂,如果你可以重建所有调用code一样,所以你在更坚实的基础,当涉及到调试等,如果你发现有一个错误在图书馆之间的相互作用并且调用code,你必须要的真正的小心你如何分析,测试和调试它,如果你不能只是重建一切,得到相同的结果。

Behaviour can change in subtle ways with things like extension methods and overloading. It's much cleaner if you can rebuild all the calling code as well, so you're on firmer ground when it comes to debugging etc. If you find there's a bug in some interaction between the library and the calling code, you'd have to be really careful about how you analysed, tested and debugged it, if you couldn't just rebuild everything and get the same results.

这篇关于向后兼容性在改变基类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆