It seems that you are describing the following situation.
- There is no
Reverse method in V1 of your MySpecialList product, so all Reverse calls are associated with an extension method of the same name - In V2 of your
MySpecialList product, the Reverse method is received, and now all previous bindings to the extension method are instead bound to the instance method.
If you want to call Reverse in the form of an instance / extension method, there is no way to prevent this, since this is the designed behavior. Instance methods will always be preferable to extension methods if they are at least as good as the version of the extension method.
The only way to prevent 100% is to call extension methods as static methods. for instance
ExtensionMethods.Reverse(list);
This problem of binding to new methods with the new version of the product is not limited only to extension methods (although the problem is probably a little worse). There are many things you can do for a type to change the method binding method, for example, introducing a new interface, inheritance, or adding a new transformation
source share