declaration-site extension methods possibly dangerous

Fatih Coskun fatih at coskuns-castle.de
Fri Dec 11 05:44:14 PST 2009


declaration-site extension methods can be easily confused with abstract 
methods of an interface. I can imagine many developers trying to 
override extension methods in their subclasses in order to provide 
different implementations. But this will not work. declaration-site 
extension methods cannot be overriden, they are hidden instead. This 
means, that the extension method will always be invoked, if the static 
type of a variable is the interface type, although the dynamic object 
type may have hidden the extension method with an own implementation. 
This will lead to much confusion. Note, that use-site extension method 
do not have this problem.


More information about the lambda-dev mailing list