Backwards compatibility when changing base class
In .NET, do I maintain binary compa开发者_如何学Gotibility when I set a new base class for a class that earlier didn't have any base class (inherits from System.Object)?
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.
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.
There shouldn't be any problem unless the base class changes the old behavior in some way.
精彩评论